diff options
| author | Kenichi Handa | 2003-04-10 12:01:10 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-04-10 12:01:10 +0000 |
| commit | b6426b0329c3f6cac18831e220a153df2ba5fc6e (patch) | |
| tree | 995cf78b11e15beb6d13327b257703550b34610e /src | |
| parent | 8d1d818a10f982b9c5f905351e0999aa1a0b6dc0 (diff) | |
| download | emacs-b6426b0329c3f6cac18831e220a153df2ba5fc6e.tar.gz emacs-b6426b0329c3f6cac18831e220a153df2ba5fc6e.zip | |
* fileio.c (Vafter_insert_file_adjust_coding_function): New
variable.
(syms_of_fileio): Declare it as a lisp variable.
(Finsert_file_contents): Call
Vafter_insert_file_adjust_coding_function before calling
decode-format.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c index 87011084643..e717e1281fe 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -177,6 +177,10 @@ Lisp_Object Vset_auto_coding_function; | |||
| 177 | /* Functions to be called to process text properties in inserted file. */ | 177 | /* Functions to be called to process text properties in inserted file. */ |
| 178 | Lisp_Object Vafter_insert_file_functions; | 178 | Lisp_Object Vafter_insert_file_functions; |
| 179 | 179 | ||
| 180 | /* Function to be called to adjust buffer-file-coding-system and the | ||
| 181 | multibyteness of the current buffer after inserting a file. */ | ||
| 182 | Lisp_Object Vafter_insert_file_adjust_coding_function; | ||
| 183 | |||
| 180 | /* Functions to be called to create text property annotations for file. */ | 184 | /* Functions to be called to create text property annotations for file. */ |
| 181 | Lisp_Object Vwrite_region_annotate_functions; | 185 | Lisp_Object Vwrite_region_annotate_functions; |
| 182 | 186 | ||
| @@ -4540,6 +4544,20 @@ actually used. */) | |||
| 4540 | Fcons (orig_filename, Qnil))); | 4544 | Fcons (orig_filename, Qnil))); |
| 4541 | } | 4545 | } |
| 4542 | 4546 | ||
| 4547 | if (set_coding_system) | ||
| 4548 | Vlast_coding_system_used = coding.symbol; | ||
| 4549 | |||
| 4550 | if (FUNCTIONP (Vafter_insert_file_adjust_coding_function)) | ||
| 4551 | { | ||
| 4552 | insval = call1 (Vafter_insert_file_adjust_coding_function, | ||
| 4553 | make_number (inserted)); | ||
| 4554 | if (! NILP (insval)) | ||
| 4555 | { | ||
| 4556 | CHECK_NUMBER (insval); | ||
| 4557 | inserted = XFASTINT (insval); | ||
| 4558 | } | ||
| 4559 | } | ||
| 4560 | |||
| 4543 | /* Decode file format */ | 4561 | /* Decode file format */ |
| 4544 | if (inserted > 0) | 4562 | if (inserted > 0) |
| 4545 | { | 4563 | { |
| @@ -4563,9 +4581,6 @@ actually used. */) | |||
| 4563 | current_buffer->undo_list = empty_undo_list_p ? Qnil : Qt; | 4581 | current_buffer->undo_list = empty_undo_list_p ? Qnil : Qt; |
| 4564 | } | 4582 | } |
| 4565 | 4583 | ||
| 4566 | if (set_coding_system) | ||
| 4567 | Vlast_coding_system_used = coding.symbol; | ||
| 4568 | |||
| 4569 | /* Call after-change hooks for the inserted text, aside from the case | 4584 | /* Call after-change hooks for the inserted text, aside from the case |
| 4570 | of normal visiting (not with REPLACE), which is done in a new buffer | 4585 | of normal visiting (not with REPLACE), which is done in a new buffer |
| 4571 | "before" the buffer is changed. */ | 4586 | "before" the buffer is changed. */ |
| @@ -6414,6 +6429,14 @@ specified in the heading lines with the format: | |||
| 6414 | or local variable spec of the tailing lines with `coding:' tag. */); | 6429 | or local variable spec of the tailing lines with `coding:' tag. */); |
| 6415 | Vset_auto_coding_function = Qnil; | 6430 | Vset_auto_coding_function = Qnil; |
| 6416 | 6431 | ||
| 6432 | DEFVAR_LISP ("after-insert-file-adjust-coding-function", | ||
| 6433 | &Vafter_insert_file_adjust_coding_function, | ||
| 6434 | doc: /* Function to call to adjust buffer-file-coding-system after inserting a file. | ||
| 6435 | The function is called with one arguemnt, the number of characters inserted. | ||
| 6436 | It should adjust `buffer-file-coding-system' and the multibyteness of | ||
| 6437 | the current buffer, and return the new character count. */); | ||
| 6438 | Vafter_insert_file_adjust_coding_function = Qnil; | ||
| 6439 | |||
| 6417 | DEFVAR_LISP ("after-insert-file-functions", &Vafter_insert_file_functions, | 6440 | DEFVAR_LISP ("after-insert-file-functions", &Vafter_insert_file_functions, |
| 6418 | doc: /* A list of functions to be called at the end of `insert-file-contents'. | 6441 | doc: /* A list of functions to be called at the end of `insert-file-contents'. |
| 6419 | Each is passed one argument, the number of characters inserted. | 6442 | Each is passed one argument, the number of characters inserted. |