/[emacs]/emacs/src/coding.c
ViewVC logotype

Diff of /emacs/src/coding.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.324 by ttn, Sun Aug 7 12:33:16 2005 UTC revision 1.325 by handa, Wed Sep 14 07:05:43 2005 UTC
# Line 5353  static int shrink_conversion_region_thre Line 5353  static int shrink_conversion_region_thre
5353        }                                                                 \        }                                                                 \
5354    } while (0)    } while (0)
5355    
5356  /* ARG is (CODING . BUFFER) where CODING is what to be set in  /* ARG is (CODING BUFFER ...) where CODING is what to be set in
5357     Vlast_coding_system_used and BUFFER if non-nil is a buffer to     Vlast_coding_system_used and the remaining elements are buffers to
5358     kill.  */     kill.  */
5359  static Lisp_Object  static Lisp_Object
5360  code_convert_region_unwind (arg)  code_convert_region_unwind (arg)
# Line 5362  code_convert_region_unwind (arg) Line 5362  code_convert_region_unwind (arg)
5362  {  {
5363    inhibit_pre_post_conversion = 0;    inhibit_pre_post_conversion = 0;
5364    Vlast_coding_system_used = XCAR (arg);    Vlast_coding_system_used = XCAR (arg);
5365    if (! NILP (XCDR (arg)))    for (arg = XCDR (arg); ! NILP (arg); arg = XCDR (arg))
5366      Fkill_buffer (XCDR (arg));      Fkill_buffer (XCAR (arg));
5367    return Qnil;    return Qnil;
5368  }  }
5369    
# Line 6081  run_pre_post_conversion_on_str (str, cod Line 6081  run_pre_post_conversion_on_str (str, cod
6081    int multibyte = STRING_MULTIBYTE (str);    int multibyte = STRING_MULTIBYTE (str);
6082    Lisp_Object old_deactivate_mark;    Lisp_Object old_deactivate_mark;
6083    Lisp_Object buffer_to_kill;    Lisp_Object buffer_to_kill;
6084      Lisp_Object unwind_arg;
6085    
6086    record_unwind_protect (Fset_buffer, Fcurrent_buffer ());    record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
6087    /* It is not crucial to specbind this.  */    /* It is not crucial to specbind this.  */
# Line 6091  run_pre_post_conversion_on_str (str, cod Line 6092  run_pre_post_conversion_on_str (str, cod
6092       unibyte<->multibyte conversion.  For that, we adjust the       unibyte<->multibyte conversion.  For that, we adjust the
6093       multibyteness of the working buffer to that of STR.  */       multibyteness of the working buffer to that of STR.  */
6094    buffer_to_kill = set_conversion_work_buffer (multibyte);    buffer_to_kill = set_conversion_work_buffer (multibyte);
6095    record_unwind_protect (code_convert_region_unwind,    if (NILP (buffer_to_kill))
6096                           Fcons (Vlast_coding_system_used, buffer_to_kill));      unwind_arg = Fcons (Vlast_coding_system_used, Qnil);
6097      else
6098        unwind_arg = list2 (Vlast_coding_system_used, buffer_to_kill);
6099      record_unwind_protect (code_convert_region_unwind, unwind_arg);
6100    
6101    insert_from_string (str, 0, 0,    insert_from_string (str, 0, 0,
6102                        SCHARS (str), SBYTES (str), 0);                        SCHARS (str), SBYTES (str), 0);
6103    UNGCPRO;    UNGCPRO;
6104    inhibit_pre_post_conversion = 1;    inhibit_pre_post_conversion = 1;
6105    if (encodep)    if (encodep)
6106      call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z));      {
6107          struct buffer *prev = current_buffer;
6108    
6109          call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z));
6110          if (prev != current_buffer)
6111            /* We must kill the current buffer too.  */
6112            Fsetcdr (unwind_arg, Fcons (Fcurrent_buffer (), XCDR (unwind_arg)));
6113        }
6114    else    else
6115      {      {
6116        Vlast_coding_system_used = coding->symbol;        Vlast_coding_system_used = coding->symbol;
# Line 6133  run_pre_write_conversin_on_c_str (str, s Line 6144  run_pre_write_conversin_on_c_str (str, s
6144  {  {
6145    struct gcpro gcpro1, gcpro2;    struct gcpro gcpro1, gcpro2;
6146    struct buffer *cur = current_buffer;    struct buffer *cur = current_buffer;
6147      struct buffer *prev;
6148    Lisp_Object old_deactivate_mark, old_last_coding_system_used;    Lisp_Object old_deactivate_mark, old_last_coding_system_used;
6149    Lisp_Object args[3];    Lisp_Object args[3];
6150    Lisp_Object buffer_to_kill;    Lisp_Object buffer_to_kill;
# Line 6149  run_pre_write_conversin_on_c_str (str, s Line 6161  run_pre_write_conversin_on_c_str (str, s
6161    insert_1_both (*str, nchars, nbytes, 0, 0, 0);    insert_1_both (*str, nchars, nbytes, 0, 0, 0);
6162    UNGCPRO;    UNGCPRO;
6163    inhibit_pre_post_conversion = 1;    inhibit_pre_post_conversion = 1;
6164      prev = current_buffer;
6165    args[0] = coding->pre_write_conversion;    args[0] = coding->pre_write_conversion;
6166    args[1] = make_number (BEG);    args[1] = make_number (BEG);
6167    args[2] = make_number (Z);    args[2] = make_number (Z);
# Line 6168  run_pre_write_conversin_on_c_str (str, s Line 6181  run_pre_write_conversin_on_c_str (str, s
6181    bcopy (BEG_ADDR, *str, coding->produced);    bcopy (BEG_ADDR, *str, coding->produced);
6182    coding->src_multibyte    coding->src_multibyte
6183      = ! NILP (current_buffer->enable_multibyte_characters);      = ! NILP (current_buffer->enable_multibyte_characters);
6184      if (prev != current_buffer)
6185        Fkill_buffer (Fcurrent_buffer ());
6186    set_buffer_internal (cur);    set_buffer_internal (cur);
6187    if (! NILP (buffer_to_kill))    if (! NILP (buffer_to_kill))
6188      Fkill_buffer (buffer_to_kill);      Fkill_buffer (buffer_to_kill);

Legend:
Removed from v.1.324  
changed lines
  Added in v.1.325

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26