Coder Social home page Coder Social logo

Comments (13)

tumashu avatar tumashu commented on August 18, 2024 1

@chuxubank 已添加,谢啦

from pyim.

et2010 avatar et2010 commented on August 18, 2024

我仿照上面这个函数写了一个关于helm的switch函数,只要helm buffer打开并激活,就切换为英文输入:

(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)

from pyim.

et2010 avatar et2010 commented on August 18, 2024

不知道为什么,我写的用于helm的这个switch函数不能用了,不知道是helm的原因还是chinese-pyim的原因?

from pyim.

tumashu avatar tumashu commented on August 18, 2024

pyim这个地方几乎没有变过,是不是helm那更新了?

from pyim.

tumashu avatar tumashu commented on August 18, 2024

chinese-pyim 添加了一个新组件: chinese-pyim-probe,专门用于收集探针函数。。。

from pyim.

hitswint avatar hitswint commented on August 18, 2024

个人很看好这个输入法,遇到一点问题就是在org或者tex中写中文时,换行后就自动转换回英文,有点不爽。仿照pyim-probe-dynamic-english写了一个函数,当前如果在行首或者indentation的位置,查找之前最近一个非空白字符,确定当前输入方式。
(defun swint-pyim-probe-dynamic-english () "Changed the behaviour of chinese-pyim at beginning of line." (if (or (= (- (point) (point-at-bol)) (current-indentation)) (= (point) (point-at-bol))) (not (or (pyim-string-match-p "\\cc" (save-excursion (if (re-search-backward "[^[:space:]]" nil t) (char-to-string (char-after (point)))))) (> (length pyim-current-key) 0))) (pyim-probe-dynamic-english)))
泪奔,居然不知道怎么在评论中输入代码。。

from pyim.

tumashu avatar tumashu commented on August 18, 2024

你说的这个应该是 pyim-probe-dynamic-english 默认的行为,这个probe会识别光标前的一个字符,只有中文字符时,才开启输入法,至于行首关闭输入法,这是为了方便输入 “*” “#+BEGIN” 等控制符的,自定义 probe就是 chinese-pyim 配置的一种方式,你这个功能用的很好

from pyim.

tumashu avatar tumashu commented on August 18, 2024

用两个 ”```“ 围起来就可以了

(defun swint-pyim-probe-dynamic-english ()
  "Changed the behaviour of chinese-pyim at beginning of line."
  (if (or (= (- (point) (point-at-bol))
             (current-indentation))
          (= (point) (point-at-bol)))
      (not (or (pyim-string-match-p
                "\\cc"
                (save-excursion
                  (if (re-search-backward "[^[:space:]]" nil t)
                      (char-to-string (char-after (point))))))
               (> (length pyim-current-key) 0)))
    (pyim-probe-dynamic-english)))

from pyim.

tumashu avatar tumashu commented on August 18, 2024

@hitswint 如果有兴趣,你可以直接 hack pyim-probe-dynamic-english 函数,然后给我发一个pull request

from pyim.

hitswint avatar hitswint commented on August 18, 2024

已经发了,第一次弄,不知道弄得对不对。

from pyim.

tumashu avatar tumashu commented on August 18, 2024

Thanks!

from pyim.

tumashu avatar tumashu commented on August 18, 2024

这个帖子人气太差,关了

from pyim.

chuxubank avatar chuxubank commented on August 18, 2024

org-mode 中的 latex fragment 和 latex 宏指令中自动切换到英文输入.
用于 pyim-english-input-switch-functions

  (defun pyim-probe-org-latex-mode ()
    (when (eq major-mode 'org-mode)
      (or
       (not (eq (org-inside-LaTeX-fragment-p) nil))
       (not (eq (org-inside-latex-macro-p) nil)))))

from pyim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.