diff options
| author | Boris Goldowsky | 1995-03-17 18:13:23 +0000 |
|---|---|---|
| committer | Boris Goldowsky | 1995-03-17 18:13:23 +0000 |
| commit | 0d420e8889d70c3a1056d76a84785ca37be2f888 (patch) | |
| tree | bb4065320b750907993ad80c1c1dd948bbb869e5 /src | |
| parent | be9aafddc105a63c4c10e35725763cb9b267de0c (diff) | |
| download | emacs-0d420e8889d70c3a1056d76a84785ca37be2f888.tar.gz emacs-0d420e8889d70c3a1056d76a84785ca37be2f888.zip | |
(Finsert_file_contents): Call format-decode.
(build_annotations): Call format-annotate-function for each element of
buffer_file_format.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c index 8a13ce5f39a..ac10154a0ab 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -128,6 +128,12 @@ int auto_save_mode_bits; | |||
| 128 | whose I/O is done with a special handler. */ | 128 | whose I/O is done with a special handler. */ |
| 129 | Lisp_Object Vfile_name_handler_alist; | 129 | Lisp_Object Vfile_name_handler_alist; |
| 130 | 130 | ||
| 131 | /* Format for auto-save files */ | ||
| 132 | Lisp_Object Vauto_save_file_format; | ||
| 133 | |||
| 134 | /* Lisp functions for translating file formats */ | ||
| 135 | Lisp_Object Qformat_decode, Qformat_annotate_function; | ||
| 136 | |||
| 131 | /* Functions to be called to process text properties in inserted file. */ | 137 | /* Functions to be called to process text properties in inserted file. */ |
| 132 | Lisp_Object Vafter_insert_file_functions; | 138 | Lisp_Object Vafter_insert_file_functions; |
| 133 | 139 | ||
| @@ -3079,6 +3085,15 @@ and (2) it puts less data in the undo list.") | |||
| 3079 | report_file_error ("Opening input file", Fcons (filename, Qnil)); | 3085 | report_file_error ("Opening input file", Fcons (filename, Qnil)); |
| 3080 | } | 3086 | } |
| 3081 | 3087 | ||
| 3088 | /* Decode file format */ | ||
| 3089 | if (inserted > 0) | ||
| 3090 | { | ||
| 3091 | insval = call3 (Qformat_decode, | ||
| 3092 | Qnil, make_number (inserted), visit); | ||
| 3093 | CHECK_NUMBER (insval, 0); | ||
| 3094 | inserted = XFASTINT (insval); | ||
| 3095 | } | ||
| 3096 | |||
| 3082 | if (inserted > 0 && NILP (visit) && total > 0) | 3097 | if (inserted > 0 && NILP (visit) && total > 0) |
| 3083 | signal_after_change (point, 0, inserted); | 3098 | signal_after_change (point, 0, inserted); |
| 3084 | 3099 | ||
| @@ -3513,6 +3528,27 @@ build_annotations (start, end) | |||
| 3513 | annotations = merge (annotations, res, Qcar_less_than_car); | 3528 | annotations = merge (annotations, res, Qcar_less_than_car); |
| 3514 | p = Fcdr (p); | 3529 | p = Fcdr (p); |
| 3515 | } | 3530 | } |
| 3531 | |||
| 3532 | /* Now do the same for annotation functions implied by the file-format */ | ||
| 3533 | if (auto_saving && (!EQ (Vauto_save_file_format, Qt))) | ||
| 3534 | p = Vauto_save_file_format; | ||
| 3535 | else | ||
| 3536 | p = current_buffer->file_format; | ||
| 3537 | while (!NILP (p)) | ||
| 3538 | { | ||
| 3539 | struct buffer *given_buffer = current_buffer; | ||
| 3540 | Vwrite_region_annotations_so_far = annotations; | ||
| 3541 | res = call3 (Qformat_annotate_function, Fcar (p), start, end); | ||
| 3542 | if (current_buffer != given_buffer) | ||
| 3543 | { | ||
| 3544 | start = BEGV; | ||
| 3545 | end = ZV; | ||
| 3546 | annotations = Qnil; | ||
| 3547 | } | ||
| 3548 | Flength (res); | ||
| 3549 | annotations = merge (annotations, res, Qcar_less_than_car); | ||
| 3550 | p = Fcdr (p); | ||
| 3551 | } | ||
| 3516 | UNGCPRO; | 3552 | UNGCPRO; |
| 3517 | return annotations; | 3553 | return annotations; |
| 3518 | } | 3554 | } |
| @@ -4260,6 +4296,18 @@ syms_of_fileio () | |||
| 4260 | staticpro (&Qfind_buffer_file_type); | 4296 | staticpro (&Qfind_buffer_file_type); |
| 4261 | #endif /* DOS_NT */ | 4297 | #endif /* DOS_NT */ |
| 4262 | 4298 | ||
| 4299 | DEFVAR_LISP ("auto-save-file-format", &Vauto_save_file_format, | ||
| 4300 | "*Format in which to write auto-save files. | ||
| 4301 | Should be a list of symbols naming formats that are defined in `format-alist'.\n\ | ||
| 4302 | If it is t, which is the default, auto-save files are written in the\n\ | ||
| 4303 | same format as a regular save would use."); | ||
| 4304 | Vauto_save_file_format = Qt; | ||
| 4305 | |||
| 4306 | Qformat_decode = intern ("format-decode"); | ||
| 4307 | staticpro (&Qformat_decode); | ||
| 4308 | Qformat_annotate_function = intern ("format-annotate-function"); | ||
| 4309 | staticpro (&Qformat_annotate_function); | ||
| 4310 | |||
| 4263 | Qcar_less_than_car = intern ("car-less-than-car"); | 4311 | Qcar_less_than_car = intern ("car-less-than-car"); |
| 4264 | staticpro (&Qcar_less_than_car); | 4312 | staticpro (&Qcar_less_than_car); |
| 4265 | 4313 | ||