From 387f6ba5c2db1ae205f0cee945e9fbd7b9662aaa Mon Sep 17 00:00:00 2001 From: Kim F. Storm Date: Tue, 12 Jul 2005 13:16:18 +0000 Subject: * coding.c (Qprocess_argument): * coding.h (Qprocess_argument): Remove unused var. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 46dd8fe780d..d74f4a93ce9 100644 --- a/src/coding.c +++ b/src/coding.c @@ -363,7 +363,7 @@ Lisp_Object Qsafe_chars; Lisp_Object Qvalid_codes; extern Lisp_Object Qinsert_file_contents, Qwrite_region; -Lisp_Object Qcall_process, Qcall_process_region, Qprocess_argument; +Lisp_Object Qcall_process, Qcall_process_region; Lisp_Object Qstart_process, Qopen_network_stream; Lisp_Object Qtarget_idx; -- cgit v1.2.1 From 16ef9c5612fdd85f6a7ca16e433f05af6e51e221 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 14 Jul 2005 07:57:42 +0000 Subject: (code_convert_region_unwind): ARG is changed to a cons. (code_convert_region): Adjusted for the above change. (set_conversion_work_buffer): If the work buffer is already in use, generate a new buffer and return it. Otherwise return Qnil. (run_pre_post_conversion_on_str): Adjusted for the above change. (run_pre_write_conversin_on_c_str): Likewise. --- src/coding.c | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index d74f4a93ce9..a4f03c70d96 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5353,12 +5353,17 @@ static int shrink_conversion_region_threshhold = 1024; } \ } while (0) +/* ARG is (CODING . BUFFER) where CODING is what to be set in + Vlast_coding_system_used and BUFFER if non-nil is a buffer to + kill. */ static Lisp_Object code_convert_region_unwind (arg) Lisp_Object arg; { inhibit_pre_post_conversion = 0; - Vlast_coding_system_used = arg; + Vlast_coding_system_used = XCAR (arg); + if (! NILP (XCDR (arg))) + Fkill_buffer (XCDR (arg)); return Qnil; } @@ -5611,7 +5616,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) Lisp_Object new; record_unwind_protect (code_convert_region_unwind, - Vlast_coding_system_used); + Fcons (Vlast_coding_system_used, Qnil)); /* We should not call any more pre-write/post-read-conversion functions while this pre-write-conversion is running. */ inhibit_pre_post_conversion = 1; @@ -5979,7 +5984,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) TEMP_SET_PT_BOTH (from, from_byte); prev_Z = Z; record_unwind_protect (code_convert_region_unwind, - Vlast_coding_system_used); + Fcons (Vlast_coding_system_used, Qnil)); saved_coding_system = Vlast_coding_system_used; Vlast_coding_system_used = coding->symbol; /* We should not call any more pre-write/post-read-conversion @@ -6025,17 +6030,31 @@ static Lisp_Object Vcode_conversion_workbuf_name; /* Set the current buffer to the working buffer prepared for code-conversion. MULTIBYTE specifies the multibyteness of the - buffer. */ + buffer. Return the buffer we set if it must be killed after use. + Otherwise return Qnil. */ -static struct buffer * +static Lisp_Object set_conversion_work_buffer (multibyte) int multibyte; { - Lisp_Object buffer; + Lisp_Object buffer, buffer_to_kill; struct buffer *buf; buffer = Fget_buffer_create (Vcode_conversion_workbuf_name); buf = XBUFFER (buffer); + if (buf == current_buffer) + { + /* As we are already in the work buffer, we must generate a new + buffer for the work. */ + Lisp_Object name; + + name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil); + buffer = buffer_to_kill = Fget_buffer_create (name); + buf = XBUFFER (buffer); + } + else + buffer_to_kill = Qnil; + delete_all_overlays (buf); buf->directory = current_buffer->directory; buf->read_only = Qnil; @@ -6048,7 +6067,7 @@ set_conversion_work_buffer (multibyte) Fwiden (); del_range_2 (BEG, BEG_BYTE, Z, Z_BYTE, 0); buf->enable_multibyte_characters = multibyte ? Qt : Qnil; - return buf; + return buffer_to_kill; } Lisp_Object @@ -6061,10 +6080,9 @@ run_pre_post_conversion_on_str (str, coding, encodep) struct gcpro gcpro1, gcpro2; int multibyte = STRING_MULTIBYTE (str); Lisp_Object old_deactivate_mark; + Lisp_Object buffer_to_kill; record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); - record_unwind_protect (code_convert_region_unwind, - Vlast_coding_system_used); /* It is not crucial to specbind this. */ old_deactivate_mark = Vdeactivate_mark; GCPRO2 (str, old_deactivate_mark); @@ -6072,7 +6090,9 @@ run_pre_post_conversion_on_str (str, coding, encodep) /* We must insert the contents of STR as is without unibyte<->multibyte conversion. For that, we adjust the multibyteness of the working buffer to that of STR. */ - set_conversion_work_buffer (multibyte); + buffer_to_kill = set_conversion_work_buffer (multibyte); + record_unwind_protect (code_convert_region_unwind, + Fcons (Vlast_coding_system_used, buffer_to_kill)); insert_from_string (str, 0, 0, SCHARS (str), SBYTES (str), 0); @@ -6115,6 +6135,7 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding) struct buffer *cur = current_buffer; Lisp_Object old_deactivate_mark, old_last_coding_system_used; Lisp_Object args[3]; + Lisp_Object buffer_to_kill; /* It is not crucial to specbind this. */ old_deactivate_mark = Vdeactivate_mark; @@ -6124,7 +6145,7 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding) /* We must insert the contents of STR as is without unibyte<->multibyte conversion. For that, we adjust the multibyteness of the working buffer to that of STR. */ - set_conversion_work_buffer (coding->src_multibyte); + buffer_to_kill = set_conversion_work_buffer (coding->src_multibyte); insert_1_both (*str, nchars, nbytes, 0, 0, 0); UNGCPRO; inhibit_pre_post_conversion = 1; @@ -6148,6 +6169,8 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding) coding->src_multibyte = ! NILP (current_buffer->enable_multibyte_characters); set_buffer_internal (cur); + if (! NILP (buffer_to_kill)) + Fkill_buffer (buffer_to_kill); } -- cgit v1.2.1 From 0b5538bd8587cfa6a9c90ff7d0c4699654dbabc6 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 7 Aug 2005 12:33:19 +0000 Subject: Update years in copyright notice; nfc. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index a4f03c70d96..794f49495fb 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1,7 +1,7 @@ /* Coding system handler (conversion, detection, and etc). Copyright (C) 1995,97,1998,2002,2003 Electrotechnical Laboratory, JAPAN. Licensed to the Free Software Foundation. - Copyright (C) 2001,2002,2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Emacs. -- cgit v1.2.1