[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: textconv.c

From: Eli Zaretskii
Subject: Re: textconv.c
Date: Sun, 12 Feb 2023 16:32:16 +0200

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 12 Feb 2023 22:05:27 +0800
> Eli Zaretskii <eliz@gnu.org> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]