From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add IME status change support on windows natively Date: Mon, 13 Apr 2020 07:53:00 +0300 Message-ID: <83k12kj8b7.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="78054"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: "Albert" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 13 06:53:47 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNr6Q-000KDj-Rv for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Apr 2020 06:53:46 +0200 Original-Received: from localhost ([::1]:40254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNr6P-0000ZV-Sd for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Apr 2020 00:53:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52683) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNr5s-00008n-R0 for emacs-devel@gnu.org; Mon, 13 Apr 2020 00:53:13 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jNr5p-0000mK-3H; Mon, 13 Apr 2020 00:53:09 -0400 Original-Received: from [176.228.60.248] (port=4018 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jNr5o-0003y2-IG; Mon, 13 Apr 2020 00:53:08 -0400 In-Reply-To: (georgealbert@qq.com) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246881 Archived-At: > From: "Albert" > Date: Mon, 13 Apr 2020 12:09:00 +0800 > > I added some code on src/w32fns.c and src/w32term.h to add IME status change support on windows > natively like gVim did. gVim can change IME status to chinese mode in insert mode and switch back to > english mode when in normal mode natively. Thanks. Can you please tell more about the uses of this feature? How would a user of Emacs use this, and what is the effect of using this on editing inside Emacs? I'm asking because we probably need to say something about this in the manual. > (add-hook 'evil-insert-state-entry-hook 'emacs-ime-enable) > (add-hook 'evil-insert-state-exit-hook 'emacs-ime-disable) I don't use Evil, so I'm not sure I understand what this does. If you describe the typical uses of this feature, I will probably understand better. In particular, why is this placed on a hook? > +/* emacs ime status change flag, used in mainThread and windowsThread */ > +static int w32_ime_status_changed = 0; > +static int w32_emacs_ime_status = 0; Can we do this without static variables? E.g., can you use the 2 parameters of the PostThreadMessage API to pass these flags? I think that would be cleaner. > +DEFUN ("w32-get-ime-open-status", > + Fw32_get_ime_open_status, Sw32_get_ime_open_status, > + 0, 0, 0, > + doc: /* Return ime open status on Windows. */) The doc string is too terse, it should say something about the returned status and its significance. > +DEFUN ("w32-set-ime-open-status", > + Fw32_set_ime_open_status, Sw32_set_ime_open_status, > + 1, 1, 0, > + doc: /* Set emacs IME open status on Windows. */) Likewise here. AFAIU, this function doesn't "set the status", it actually opens or closes the IME. If so, the doc string should say that, and it should explicitly mention the argument of the function and its significance. Thank you for working on this.