emacs-devel
[Top][All Lists]
Advanced

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

Strange code in find-composition-internal


From: Eli Zaretskii
Subject: Strange code in find-composition-internal
Date: Sat, 24 Apr 2010 19:13:28 +0300

This is a fragment from find-composition-internal that attempts to
find a composition, either static (i.e. defined by a `composition'
text property) or automatic, near the position POS:

  if (!find_composition (from, to, &start, &end, &prop, string))
    {
      if (!NILP (current_buffer->enable_multibyte_characters)
          && ! NILP (Vauto_composition_mode)
          && find_automatic_composition (from, to, &start, &end, &gstring,
                                         string))
        return list3 (make_number (start), make_number (end), gstring);
      return Qnil;
    }
  if ((end <= XINT (pos) || start > XINT (pos)))
    {
      EMACS_INT s, e;

      if (find_automatic_composition (from, to, &s, &e, &gstring, string)
          && (e <= XINT (pos) ? e > end : s < start))
        return list3 (make_number (start), make_number (end), gstring);
    }

The doc string of find-composition says, among other things:

    When Automatic Compostion mode is on, this function also finds a
    chunk of text that is automatically composed.  If such a chunk is
    found closer to POS than the position that has `composition'
    property, the value is a list of FROM, TO, and a glyph gstring
    the specify how the chunk is composed.

But the code fragment above seems to return `start' and `end' from the
static composition even if find_automatic_composition finds an
automatic composition that is closer to POS, which is contrary to the
doc.

Shouldn't the last line be

        return list3 (make_number (s), make_number (e), gstring);

?  Or am I missing something?




reply via email to

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