Emacs can not activate fcitx

1.4k Views Asked by At

I can use fcitx normally in all of other programs. But I can't not use fcitx in Emacs which means I can not switch to other input method such as Chinese input method. I tried a lot and Googled a lot didn't find solution. This confuses me a lot!

I use emacs -q to start emacs.

Can you help me? Thanks in advance!

  1. Emacs version: 25.1.1
  2. fcitx version: 4.2.8.5
  3. Operating system: Slackware 14.2

uname -a output:

Linux Planet 4.4.38 #2 SMP Sun Dec 11 16:18:36 CST 2016 x86_64 Intel(R) Core(TM) i3-2330M CPU @ 2.20GHz GenuineIntel GNU/Linux

fcitx-diagnose output: fcitx-diagnose

~/.xprofile and ~/.profile both contain the following:

export XMODIFIERS=@im=fcitx
export LC_CTYPE=zh_CN.UTF-8
export QT_IM_MODULE=fcitx
export GTK_IM_MODULE=fcitx
2

There are 2 best solutions below

0
On

I've encountered something like this as well. The problem has something to do with locale settings (LC_CTIME in your case).

In my case, fcitx stopped working when I set LC_TIME for Emacs to en. Emacs daemon complained: Locale not supported by C library. Using the fallback 'C' locale. I'm not sure if the problem is caused by an invalid / unavailable locale or setting the locale to anything other than default.

Either way, removing your LC_CTIME line in your profile files should help.

0
On

These are a few steps that worked for me:

  1. Edit the /etc/locale.gen file, uncomment zh_CN.UTF-8 UTF-8 line.
  2. Run sudo locale-gen.
  3. Make sure the correct fonts are installed. I used manjaro, so I installed xorg-fonts-misc-otb from AUR, the xorg-fonts-misc no longer provides the required fonts according to https://wiki.archlinux.org/index.php/Fcitx#Emacs. NOTE that needs to reboot after font installation.
  4. Start emacs with the command: LC_CTYPE=zh_CN.UTF-8 XMODIFIERS=@im=fcitx emacs. Reference: https://fcitx-im.or/wiki/Input_method_related_environment_variables