unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Crash using text property 'composite on w32
       [not found]     ` <87bqfl5g90.fsf@stupidchicken.com>
@ 2007-06-14 12:32       ` Kenichi Handa
  2007-06-14 12:42         ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 2+ messages in thread
From: Kenichi Handa @ 2007-06-14 12:32 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

In article <87bqfl5g90.fsf@stupidchicken.com>, Chong Yidong <cyd@stupidchicken.com> writes:

> The following message is a courtesy copy of an article
> that has been posted to gmane.emacs.bugs as well.

> "Juanma Barranquero" <lekktu@gmail.com> writes:

> > Program received signal SIGSEGV, Segmentation fault.
> > 0x010c798a in run_composition_function (from=267, to=269, prop=520)
> >    at composite.c:456
> > 456       func = COMPOSITION_MODIFICATION_FUNC (prop);
> > (gdb) bt
> > #0  0x010c798a in run_composition_function (from=267, to=269, prop=520)
> >    at composite.c:456
> > #1  0x010c7d1c in update_compositions (from=269, to=271, check_mask=3)
> >    at composite.c:514

> The trouble here is that the code expects the property `prop' obtained
> from find_composition to be a valid composition, which is a cons.  So
> probably the way to fix this is to stick in a couple of
> COMPOSITION_VALID_P checks into update_compositions, around
> composite.c:514.

Thank you for finding this bug.  You are right.  I installed
a fix in the trunk.  Anyway, composition property should not
be attached manually as this:

(let ((s "text"))
   (put-text-property 0 2 'composition ?A s)
   (insert s))

Instead, people should use compose-region or compose-string
as this:

(insert (compose-string "text" 0 2 ?A))

> The strange thing, though, is that the elisp manual describes the
> composition property as follows (documented by Handa on 2007-04-19):

>   `composition'
>      This text property is used to display a sequence of characters as a
>      single glyph composed from components.  For instance, in Thai a
>      base consonant is composed with the following combining vowel as a
>      single glyph.  The value should be a character or a sequence
>      (vector, list, or string) of integers.

>         * If it is a character, it means to display that character
>           instead of the text in the region.

>         * If it is a string, it means to display that string's contents
>           instead of the text in the region.

>         * If it is a vector or list, the elements are characters
>           interleaved with internal codes specifying how to compose the
>           following character with the previous one.

> Is this a mistake?

Yes.  The above description is for the argument COMPONENTS
of the function `compose-region', or for just a part of the
property value.  The value has this form:

   The property value has this form when the composition is made:
	((LENGTH . COMPONENTS) . MODIFICATION-FUNC)
   then turns to this form:
	(COMPOSITION-ID . (LENGTH COMPONENTS-VEC . MODIFICATION-FUNC))
   when the composition is registered in composition_hash_table and
   composition_table.  These rather peculiar structures were designed
   to make it easy to distinguish them quickly (we can do that by
   checking only the first element) and to extract LENGTH (from the
   former form) and COMPOSITION-ID (from the latter form).
   [...]

The detail is described in the header comment of
src/composite.c.  How much detail, do you think, we should
describe in Info?

Isn't it enough to say just as below?

The value should be a cons of special structure.  It should
be manipulated only by the functions `compose-region',
`compose-string' and `find-composition'.

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Crash using text property 'composite on w32
  2007-06-14 12:32       ` Crash using text property 'composite on w32 Kenichi Handa
@ 2007-06-14 12:42         ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 2+ messages in thread
From: Lennart Borgman (gmail) @ 2007-06-14 12:42 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: Chong Yidong, emacs-devel

Kenichi Handa wrote:
> The value should be a cons of special structure.  It should
> be manipulated only by the functions `compose-region',
> `compose-string' and `find-composition'.


If that is the case then I think the elisp manual should say that and 
nothing else.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-14 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <466D7903.6040508@gmail.com>
     [not found] ` <466DDFA5.3090202@gnu.org>
     [not found]   ` <f7ccd24b0706111707n6455fb3bs9fdd6eb790269ef7@mail.gmail.com>
     [not found]     ` <87bqfl5g90.fsf@stupidchicken.com>
2007-06-14 12:32       ` Crash using text property 'composite on w32 Kenichi Handa
2007-06-14 12:42         ` Lennart Borgman (gmail)

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).