桌面: KDE
.
目前已知neovim/chrome/chromium
等环境下都能使用ibus-rime
输入中文, emacs
中能跳出输入的候选栏(更新: 现在候选栏也没有了, 不知道是不是因为改了哪里的locale了), 但是按下SPC满怀期待的希望看到汉字出现在emacs
, 始终不能如愿, 光标依旧停留在原处, . 终端的话只有neovim下能输入中文, 其他情景下不能, 包括non-neovim
的vim
下.
这篇帖子(Emacs GUI下不能输入中文)是将fcitx
的, 目前spacemacs有chinese这个layer里面对fcitx做了适配, ibus的话https://github.com/pkg-ime/ibus-el
这里有一个, 我把它做成了layer后, 状况依然没有变化.
具体做法我是将.spacemacs
改名为init.el, 并且放置在.spacemacs.d
这个新建的文件夹中, 并且在这个文件夹中新建 ibus 这个文件夹, 如图所示:
在/.spacemacs.d/init.el
中我做了如下修改:
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
(require 'ibus)
(add-hook 'after-init-hook 'ibus-mode-on)
)
而我的/ibus/config.el全文如下:
(load-file "~/.spacemacs.d/layers/ibus/local/ibus.el")
(load-file "~/.spacemacs.d/layers/ibus/local/ibus-el-agent")
packages.el全文如下(我没有作改动, 是自动生成的):
;;; packages.el --- ibus layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: czxyl <czxyl@archlinux>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Commentary:
;; See the Spacemacs documentation and FAQs for instructions on how to implement
;; a new layer:
;;
;; SPC h SPC layers RET
;;
;;
;; Briefly, each package to be installed or configured by this layer should be
;; added to `ibus-packages'. Then, for each package PACKAGE:
;;
;; - If PACKAGE is not referenced by any other Spacemacs layer, define a
;; function `ibus/init-PACKAGE' to load and initialize the package.
;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so
;; define the functions `ibus/pre-init-PACKAGE' and/or
;; `ibus/post-init-PACKAGE' to customize the package as it is loaded.
;;; Code:
(defconst ibus-packages
'()
"The list of Lisp packages required by the ibus layer.
Each entry is either:
1. A symbol, which is interpreted as a package to be installed, or
2. A list of the form (PACKAGE KEYS...), where PACKAGE is the
name of the package to be installed or loaded, and KEYS are
any number of keyword-value-pairs.
The following keys are accepted:
- :excluded (t or nil): Prevent the package from being loaded
if value is non-nil
- :location: Specify a custom installation location.
The following values are legal:
- The symbol `elpa' (default) means PACKAGE will be
installed using the Emacs package manager.
- The symbol `local' directs Spacemacs to load the file at
`./local/PACKAGE/PACKAGE.el'
- A list beginning with the symbol `recipe' is a melpa
recipe. See: https://github.com/milkypostman/melpa#recipe-format")
;;; packages.el ends here
我知道上述做法是错的, 因为spacemacs启动出错了:
emacs --debug-init信息如下:
最后贴下以下命令的输出:
➜ ~ localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: n/a
X11 Layout: cn
X11 Model: pc101
➜ ~ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX
de_DE
de_DE.iso88591
deutsch
en_US.utf8
german
➜ ~ python2 -c "import sys; print sys.getfilesystemencoding()"
ANSI_X3.4-1968
➜ ~ grep -v '#' /etc/locale.gen
en_US.UTF-8 UTF-8
de_DE ISO-8859-1
en_US.UTF-8 UTF-8
➜ ~ env | grep LANG
LANG=mn_CN.UTF-8
LANGUAGE=zh_CN:en_US
➜ ~
不知道该该如何解决了, 希望大家点拨下,
更新: Emacs GUI下不能输入中文 - #23,来自 xuchunyang 这一楼能解决我的问题