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

deactivate-current-input-method-functionを設定するタイミングは正しいか? #18

Open
naota opened this issue Nov 22, 2023 · 2 comments

Comments

@naota
Copy link

naota commented Nov 22, 2023

deactivate-current-input-method-functionは以下のように説明されています。すなわち、input methodがactivateされた時に設定されるべきであるようです。

(defvar-local deactivate-current-input-method-function nil
  "Function to call for deactivating the current input method.
Every input method should set this to an appropriate value when activated.
This function is called with no argument.

This function should never change the value of `current-input-method'.
It is set to nil by the function `deactivate-input-method'.")

一方、tc.elではこれを tcode-use-package の中で設定しています。
結局は、その後 tcode-activate が呼ばれるのですが、 tcode-activateの中で設定する方が適切かもしれません。

@ujimushi
Copy link

なるほど。そうですね。

この関数の説明文,deactivate-input-methodの中で,いちいちdeactivate-current-input-method-functionnil にしてると読み取れ,もしそうだとするとtcode-activateの中で設定するのはマストな気がします。

ということで,deactivate-input-method関数のソースを読むと,
deactivate-current-input-method-functionは呼び出すだけで値の変更はされず,nilにしているのはcurrent-input-methodだけです。

結果として,tc.elのみを使っている限りは現状の動きでも問題は無さそうに見えます。

どうやら説明文中下の方の It is set to nilを示す単語はcurrent-input-methodのようで,
上側の文章も,
activateのタイミングではdeactivate-current-input-method-functionが設定されているべき」
と解釈すべきなのかもしれません。

@naota
Copy link
Author

naota commented Dec 1, 2023

なるほど、そう思うとたしかに register-input-method() でactivateの関数として設定されているのは tcode-use-package で、その中でちゃんと deactivate-current-input-method-function が設定されているんですよね。

ということは、本来の問題は tcode-use-package がactivateの関数で tcode-activate はそのヘルパーである。だが、名前はまぎわらしい、というところかなと思ってきました。

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

2 participants