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

能不能设置一个开关,可以将mini buffer中输入法屏蔽? #34

Closed
et2010 opened this issue Apr 25, 2015 · 10 comments
Closed

Comments

@et2010
Copy link
Contributor

et2010 commented Apr 25, 2015

这个输入法非常赞!但有一个问题:
当输入法开启时,如果C-h v,选词会出现在mini buffer中,对英文变量名的输入造成影响。

但是除了这种情况之外,minibuffer中的选词还是非常有用的,搜索替换中文都很好用。是不是可以建一个列表,凡是不需要输入法的函数就丢进去?

@tumashu
Copy link
Owner

tumashu commented Apr 25, 2015

同学可以参考 #15, 只要你能写一个函数,判断在什么情况下需要开启输入法,上面的功能就可以简单实现。。。。

@et2010
Copy link
Contributor Author

et2010 commented Apr 25, 2015

非常抱歉提交了一个重复的issue。因为我用helm,C-h v后,会弹出helm buffer,但我还是elisp菜鸟,不知怎样捕捉到这个buffer。如果可以捕捉这个buffer,我想应该可以像 #21 那样写一个函数。

还有issue #21 中的函数貌似是针对某个major mode的,但是helm是全局的,如果再写一个针对helm的函数,和org-speed那个不会冲突吗?

@tumashu
Copy link
Owner

tumashu commented Apr 25, 2015

这个的思路非常多,比如你通过可以通过当前执行的命令来判断,通过buffer mode 来判断,甚至通过当前字符串来判断。。。。具体就要看你的实际情况了。

@tumashu
Copy link
Owner

tumashu commented Apr 25, 2015

org-speed是一个同学的配置,chinese-pyim没有包含。。。

@et2010
Copy link
Contributor Author

et2010 commented Apr 26, 2015

Thanks, that solved my question.
But still, how to handle multiple switch functions?

BTW, I wrote a switch function for helm, check it out: #21

@et2010
Copy link
Contributor Author

et2010 commented Apr 26, 2015

目前的解决方案:

(defun pyim-helm-buffer-active-p ()
  (string-prefix-p "helm" (buffer-name (window-buffer (active-minibuffer-window)))))

(setq pyim-english-input-switch-function
      'pyim-helm-buffer-active-p)

@et2010 et2010 closed this as completed Apr 26, 2015
@tumashu
Copy link
Owner

tumashu commented Apr 26, 2015

multi-switch ,
you can use cl-some

@Liu233w
Copy link
Contributor

Liu233w commented Oct 1, 2016

#21 (comment) 所说,这个函数的确不管用了。我写了一个函数加到了 hook 里面,可以在进入或退出 helm 的时候自动切换输入法:

    ;; 进入helm 的时候自动关闭当前的输入法,退出时自动恢复到之前的状态 =======
    (defvar liu233w//helm-pyim-switch--last-im
      nil
      "最后切换的输入法")
    (make-variable-buffer-local 'liu233w//helm-pyim-switch--last-im)

    (defun liu233w/helm-pyim-enter ()
      (setq liu233w//helm-pyim-switch--last-im current-input-method)
      (set-input-method nil))
    (defun liu233w/helm-pyim-exit ()
      (set-input-method liu233w//helm-pyim-switch--last-im)
      (setf liu233w//helm-pyim-switch--last-im nil))

    (add-hook 'helm-minibuffer-set-up-hook #'liu233w/helm-pyim-enter)
    (add-hook 'helm-exit-minibuffer-hook #'liu233w/helm-pyim-exit)
    ;; ========================================================================

@tumashu
Copy link
Owner

tumashu commented Oct 2, 2016

这道也是个办法,emacs的好处就是这样的,折腾性太强了

@chuxubank
Copy link

现在貌似直接将 helm--alive-p 添加进 pyim-english-input-switch-functions 中即可

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

4 participants