diff src/coding.c @ 83212:f70dc61a797f

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-581 Fix exec-shield autoconf test * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-582 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-583 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-584 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-585 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-586 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-587 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-588 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-589 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-590 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-591 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-592 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-38 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-39 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-40 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-41 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-252
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 03 Oct 2004 13:08:55 +0000
parents 4a196c3bd2d8 9093a2e9c3fd
children 549734260e34
line wrap: on
line diff
--- a/src/coding.c	Wed Sep 29 08:38:15 2004 +0000
+++ b/src/coding.c	Sun Oct 03 13:08:55 2004 +0000
@@ -5646,8 +5646,11 @@
 	coding_allocate_composition_data (coding, from);
     }
 
-  /* Try to skip the heading and tailing ASCIIs.  */
-  if (coding->type != coding_type_ccl)
+  /* Try to skip the heading and tailing ASCIIs.  We can't skip them
+     if we must run CCL program or there are compositions to
+     encode.  */
+  if (coding->type != coding_type_ccl
+      && (! coding->cmp_data || coding->cmp_data->used == 0))
     {
       int from_byte_orig = from_byte, to_byte_orig = to_byte;
 
@@ -5663,6 +5666,7 @@
 	  if (!replace)
 	    /* We must record and adjust for this new text now.  */
 	    adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len);
+	  coding_free_composition_data (coding);
 	  return 0;
 	}
 
@@ -6293,13 +6297,19 @@
   if (coding->composing != COMPOSITION_DISABLED)
     coding_save_composition (coding, from, to, str);
 
-  /* Try to skip the heading and tailing ASCIIs.  */
-  if (coding->type != coding_type_ccl)
+  /* Try to skip the heading and tailing ASCIIs.  We can't skip them
+     if we must run CCL program or there are compositions to
+     encode.  */
+  if (coding->type != coding_type_ccl
+      && (! coding->cmp_data || coding->cmp_data->used == 0))
     {
       SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str),
 				1);
       if (from == to_byte)
-	return (nocopy ? str : Fcopy_sequence (str));
+	{
+	  coding_free_composition_data (coding);
+	  return (nocopy ? str : Fcopy_sequence (str));
+	}
       shrinked_bytes = from + (SBYTES (str) - to_byte);
     }