Mercurial > emacs
comparison src/coding.c @ 90231:8be9e4c6d687
(encode_coding_object): If a pre-write-conversion
function makes a new buffer, kill it.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 23 Sep 2005 07:06:22 +0000 |
parents | 2d92f5c9d6ae |
children | c59afb15f5c6 |
comparison
equal
deleted
inserted
replaced
90230:fa744c8b8632 | 90231:8be9e4c6d687 |
---|---|
6885 EMACS_INT chars = to - from; | 6885 EMACS_INT chars = to - from; |
6886 EMACS_INT bytes = to_byte - from_byte; | 6886 EMACS_INT bytes = to_byte - from_byte; |
6887 Lisp_Object attrs; | 6887 Lisp_Object attrs; |
6888 Lisp_Object buffer; | 6888 Lisp_Object buffer; |
6889 int saved_pt = -1, saved_pt_byte; | 6889 int saved_pt = -1, saved_pt_byte; |
6890 int kill_src_buffer = 0; | |
6890 | 6891 |
6891 buffer = Fcurrent_buffer (); | 6892 buffer = Fcurrent_buffer (); |
6892 | 6893 |
6893 coding->src_object = src_object; | 6894 coding->src_object = src_object; |
6894 coding->src_chars = chars; | 6895 coding->src_chars = chars; |
6922 args[0] = CODING_ATTR_PRE_WRITE (attrs); | 6923 args[0] = CODING_ATTR_PRE_WRITE (attrs); |
6923 args[1] = make_number (BEG); | 6924 args[1] = make_number (BEG); |
6924 args[2] = make_number (Z); | 6925 args[2] = make_number (Z); |
6925 safe_call (3, args); | 6926 safe_call (3, args); |
6926 } | 6927 } |
6928 if (XBUFFER (coding->src_object) != current_buffer) | |
6929 kill_src_buffer = 1; | |
6927 coding->src_object = Fcurrent_buffer (); | 6930 coding->src_object = Fcurrent_buffer (); |
6928 if (BEG != GPT) | 6931 if (BEG != GPT) |
6929 move_gap_both (BEG, BEG_BYTE); | 6932 move_gap_both (BEG, BEG_BYTE); |
6930 coding->src_chars = Z - BEG; | 6933 coding->src_chars = Z - BEG; |
6931 coding->src_bytes = Z_BYTE - BEG_BYTE; | 6934 coding->src_bytes = Z_BYTE - BEG_BYTE; |
7024 else | 7027 else |
7025 TEMP_SET_PT_BOTH (saved_pt + (coding->produced - bytes), | 7028 TEMP_SET_PT_BOTH (saved_pt + (coding->produced - bytes), |
7026 saved_pt_byte + (coding->produced - bytes)); | 7029 saved_pt_byte + (coding->produced - bytes)); |
7027 } | 7030 } |
7028 | 7031 |
7032 if (kill_src_buffer) | |
7033 Fkill_buffer (coding->src_object); | |
7029 unbind_to (count, Qnil); | 7034 unbind_to (count, Qnil); |
7030 } | 7035 } |
7031 | 7036 |
7032 | 7037 |
7033 Lisp_Object | 7038 Lisp_Object |