From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: textconv.c Date: Sun, 12 Feb 2023 16:32:16 +0200 Message-ID: <83ilg7gdjj.fsf@gnu.org> References: <83r0uvghw7.fsf@gnu.org> <87k00nyo60.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40590"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Feb 12 15:33:43 2023 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 1pRDQE-000AP5-TX for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Feb 2023 15:33:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRDPY-0000Bv-MQ; Sun, 12 Feb 2023 09:33:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRDPH-0000Ay-MH for emacs-devel@gnu.org; Sun, 12 Feb 2023 09:32:43 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRDPH-0007FN-Cv; Sun, 12 Feb 2023 09:32:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3jenDbh7KJmu1MP6rX/GBX/lxm1/zJ8bbDIOJcnfpKs=; b=Qgpd5Iw2oaUM q7MU43y6opOH/BGWTkoYCTpTjwPAHtWTSuXHkd8c/s8005C+sbZ1taoXPqzR5cv4cRrnY+7U/Rh9s 1303x7MNeq8JQdFNwvdM2hAVZbxjlRu0k4YQk1lkkZ4PYYUHipHRNP7er02p37loJaRtltLEbFAqJ cUzM60tpXFil5mdNZjvl8WTlIHgAbb+OdgGJJjalSaSGdA9HDKlKlAvC+5vkQtagwlC6Uc247XuUb Mz85mqh6JYg/uDWnB2uPYPgxOo7hczxHrxhayEXlR67IPqlF0zdGBm9iJNGoEA2mkmBDGwBbDgTlC KJsT+aQwf7Nj09Y/BkO98Q==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRDPG-0007B0-Rk; Sun, 12 Feb 2023 09:32:43 -0500 In-Reply-To: <87k00nyo60.fsf@yahoo.com> (message from Po Lu on Sun, 12 Feb 2023 22:05:27 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303177 Archived-At: > From: Po Lu > Cc: emacs-devel@gnu.org > Date: Sun, 12 Feb 2023 22:05:27 +0800 > > Eli Zaretskii writes: > > > Please move the code which manipulates buffer text and the gap to > > insdel.c. And I don't really understand why you needed to add > > copy_buffer, since we already have insert_from_buffer and copy_text. > > > > The rest (textconv_query) should go to some existing file(fns.c, > > perhaps?). There's no justification for a new file for such a little > > code. > > > > Thanks. > > That code is going to be significantly expanded in the feature/android > branch, so I expect it will become much larger (and definitely worth its > own file.) I don't see how this changes the situation in any significant way. If and when we see that the added stuff is too large, we can then decide to split some of it. But not in advance, and we are not there yet. > `insert_from_buffer' inserts text into a buffer, instead of copying out > of a buffer I don't see why this is important, since you can switch the buffer temporarily. We do this all over the place, since insdel.c always works on the current buffer. > and `copy_text' seems to not handle the gap nor work on character > positions. Look at its callers, and you will see how that part is done. In a nutshell, you prepare the gap in advance, and then call copy_text. > There will be many more changes on the feature/android branch, since > Android input methods more or less can't work without the ability to > perform arbitrary modifications to buffer text, and the ability to > obtain buffer contents and the position of the point in the buffer being > displayed. [lots of details omitted] And you intended to produce code which supports this without any discussions of the architecture and design? I'm surprised, to say the least. This has to be discussed, with the participation of everyone on board who knows about the Emacs internals related to these issues. We have here a significant amount of knowledge, expertise, and past experience with similar issues, and disregarding that and trying to solve this by your lone self is at the very least unwise. My suggestion is that you describe the problem(s), i.e. what these input methods expect from the client application, in enough detail that will allow people here think about it and suggest solutions. Please don't write even a single line of code before such a description is posted and people have enough time to respond with suggestions, ideas, and questions. (I have already a couple of ideas, but will withhold them until I'm convinced that I understand the problems to be solved.) P.S. And please start a thread with a new, more meaningful name when you post those details. Thanks.