使用反馈:smart-input-source 挂 emacs-rime

:joy: :joy: :joy: :joy:

@goumao smart-input-source已经能够正常使用了。多谢。可以从elpa正常安装。昨天的问题只能由quelpa来背锅了。我发现只要生成autoload.el就会出错。

使用过程中有两个需求不知道能否满足:

能否让smart-input-source启动emacs-rime?

我期望的使用情景是进入一个buffer,默认输入英文,在任意位置连续输入之后切换到中文输入。现在需要手工打开emacs-rime,然后才能由smart-input-source来自动切换中英文。由于我使用dumper,emacs-rime只能默认让emacs-rime defer,否则dump会失败。

能否用space space来自动退出inline english?

用space enter不够流畅。目前space space退出inline english会残留一个空格。

我这里也是生成autoload的啊,并没有问题。
我再研究一下

smart-input-source-set-other 命令,启用rime。
smart-input-source-switch 命令,在开rime和关rime之间切换。
是你要的功能么?

<spc><spc>inline english<spc><spc>,会前后各留一个空格,且切回到中文。
<spc>inline english<spc><RET>,会前后无空格,且切回到中文。

因为:

  1. 尾部以空格结尾,会切回中文。
  2. 头尾会各删除一个空格。

我打算加一个选项:头尾是只删除一个空格,还是删除所有空格。

@goumao 现在在melpa上面安装的包里面的autoloads就是正常的。暂时先别管这个问题了。我对比过,现在melpa包的autoloads里面的所有变量和函数都是完整的名字;而之前quelpa包里面的autoloads里面的变量和函数名都没有包含namespace,并且排版十分混乱,基本就是smart-input-source.el的所有内容。

我已经使用 smart-input-source-set-other启动了emacs-rime。多谢。最终的效果和我的需要还有点距离。现在我这边打开emacs之后自动进入了中文输入状态。我的需要是:打开emacs之后就启动smart-input-source和emacs-rime,但是默认处于英文输入状态;需要输入中文时,通过space space进入中文输入状态。

那就添加一个选项吧,我不喜欢留空格。

那你只能手工交换 english 和 other 的配置了。

但是,那样也有问题。
就是你打开minibuffer等,默认都是中文。

这个需求,倒是有点意思,
我考虑考虑能不能实现。

===更新====
搞一个 inline-chinese-mode,嗯,可以的。

最新版已经可以实现了:

这一点不是预期的行为。除非你自己定制了。
with-english 选项默认是开的,打开emacs之后,默认是英文。

好用。多谢。

还会实现吗?

@yqu212

已经实现了!

(setq-default smart-input-source-inline-with-other t)

用上了。多谢。

挂 emacs-rime 的时候发现 smart-input-source-global-respect-mode 会让 (setq default-input-method "rime") 失效

respect-mode 并没有特别的对内置输入法进行处理。

所有和内置输入法有关的,就是你在配置的时候的挂接:
牵涉到 current-input-methodset-input-method

(setq-default smart-input-source-english nil)
(setq-default smart-input-source-other "rime")
(setq-default smart-input-source-do-get (lambda() current-input-method))
(setq-default smart-input-source-do-set (lambda(source) (set-input-method source)))

你说的失效,
是什么现象?
如何复现?

就是 (setq default-input-method "rime"),describe-value 值是对的。如果 M-x smart-input-source-global-respect-mode,default-input-method 的值就变成 nil 了。

(use-package smart-input-source
  :quelpa (smart-input-source :fetcher github :repo "laishulu/emacs-smart-input-source")
  ;; :hook ((after-init . smart-input-source-global-respect-mode)
  ;;        (org-mode . smart-input-source-follow-context-mode)
  ;;        (org-mode . smart-input-source-inline-mode))
  :config
  (setq-default smart-input-source-inline-tighten-head-rule 0
                smart-input-source-inline-tighten-tail-rule 1)
  (setq-default smart-input-source-other "rime")
  (setq smart-input-source-english nil)
  (setq smart-input-source-do-get (lambda () current-input-method)
        smart-input-source-do-set (lambda (source) (set-input-method source))))

那是因为,mode启动的时候,自动设置成英文了。
你设成nil,就不改变当前的状态。

default-input-method 应该是和当前输入状态无关的变量?是 C-\ 选择的输入法,自动设置英文为什么需要改变这个变量。ps 设置 smart-input-source-respect-start nil 也会改变 default-input-method 为 nil,并且设置不回去了。

是的,无关的变量。
本package操作的是current-input-method,不是default-input-method.

这个就很奇怪了。本package其实没有一行代码是关于内置输入法的。
唯一相关的地方,就是用户自己config进去的挂接代码。
就像和im-select/fcitx的处理一样。

我本地复现了。。。
正在查找原因。

@Voleking 这个是emacs系统自己的行为,set-input-method 就是会改变default-input-method。 下面这个截屏来源于emacs自带的系统实现。

你切到中文输入法,这个值也会变成rime

我一会写个新的配置example。。。通用配置。。。。

  ;; (setq-default default-input-method "rime")
  (setq-default smart-input-source-english nil)
  (setq-default smart-input-source-other default-input-method)
  (setq-default smart-input-source-do-get (lambda() current-input-method))
  (setq-default smart-input-source-do-set
                (lambda(source)
                  (unless (equal source current-input-method)
                    (toggle-input-method))))