all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: phst@google.com, emacs-devel@gnu.org
Subject: Re: [PATCH] Allow inserting non-BMP characters
Date: Tue, 26 Dec 2017 10:35:42 +0000	[thread overview]
Message-ID: <CAArVCkSMeQcjxz0CCsjaOU55e7g=AwsE+dU9LDCajye6JzujeA@mail.gmail.com> (raw)
In-Reply-To: <83d132hz9e.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]

Eli Zaretskii <eliz@gnu.org> schrieb am Di., 26. Dez. 2017 um 05:46 Uhr:

> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Date: Mon, 25 Dec 2017 22:01:15 +0100
> > Cc: Philipp Stephani <phst@google.com>
> >
> > +/* Return the Unicode code point for the given UTF-16 surrogates.  */
> > +
> > +INLINE int
> > +surrogates_to_codepoint (int low, int high)
> > +{
> > +  eassert (char_low_surrogate_p (low));
> > +  eassert (char_high_surrogate_p (high));
> > +  return 0x10000 + (low - 0xDC00) + ((high - 0xD800) * 0x400);
> > +}
> > +
> >  /* Data type for Unicode general category.
>
> Suggest to move surrogates_to_codepoint to coding.c, and then use the
> macros UTF_16_HIGH_SURROGATE_P and UTF_16_LOW_SURROGATE_P defined
> there.


Hmm, I'd rather go the other way round and remove these macros later. They
are macros, thus worse than functions, and don't seem to be correct either
(what about a value such as 0x11DC00?).


>   Also, a single-liner sounds like too little to justify a
> function, so maybe make all of that macros in coding.h, and include
> the latter in nsterm.m.
>

No new macros please if we can avoid it. Functions are strictly better.
I don't care much whether they are in character.h or coding.h, but
char_surrogate_p is already in character.h.


>
> > +  USE_SAFE_ALLOCA;
> > +  unichar *utf16_buffer;
> > +  SAFE_NALLOCA (utf16_buffer, 1, len);
>
> Maximum length of a UTF-16 sequence is known in advance, so why do you
> need SAFE_NALLOCA here?  Couldn't you use a buffer of fixed length
> instead?
>
>
The text being inserted can be arbitrarily long. Even single characters
(i.e. extended grapheme clusters) can be arbitrarily long.

[-- Attachment #2: Type: text/html, Size: 2532 bytes --]

  reply	other threads:[~2017-12-26 10:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-24 16:00 bug#29837: UTF-16 char display problems and the macOS "character palette" Alan Third
2017-12-24 16:56 ` Eli Zaretskii
2017-12-24 18:23   ` Alan Third
2017-12-24 18:57     ` Eli Zaretskii
2017-12-24 19:28       ` Alan Third
2017-12-24 19:34         ` Eli Zaretskii
2017-12-25 20:13           ` Philipp Stephani
2017-12-25 21:01             ` [PATCH] Allow inserting non-BMP characters Philipp Stephani
2017-12-26  1:26               ` Alan Third
2017-12-26  4:46               ` Eli Zaretskii
2017-12-26 10:35                 ` Philipp Stephani [this message]
2017-12-26 16:11                   ` Eli Zaretskii
2017-12-26 18:50                     ` Philipp Stephani
2017-12-26 20:22                       ` Eli Zaretskii
2017-12-26 21:36                         ` Alan Third
2017-12-27  3:41                           ` Eli Zaretskii
2017-12-28 11:38                             ` Alan Third
2017-12-28 12:31                               ` Philipp Stephani
2017-12-28 16:29                                 ` Eli Zaretskii
2017-12-29 20:14                                   ` Philipp Stephani
2017-12-29 20:27                                     ` Eli Zaretskii
2018-01-07 15:51                                       ` Philipp Stephani
2018-01-07 17:40                                         ` Eli Zaretskii
2018-01-07 18:44                                           ` Philipp Stephani
2017-12-25 21:07             ` bug#29837: UTF-16 char display problems and the macOS "character palette" Philipp Stephani
2017-12-26  1:34             ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAArVCkSMeQcjxz0CCsjaOU55e7g=AwsE+dU9LDCajye6JzujeA@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=phst@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.