Mercurial > hg > xemacs-beta
comparison src/fileio.c @ 5004:788c38f20376
Do not assume #'format-decode exists in fileio.c.
src/ChangeLog addition:
2010-02-07 Aidan Kehoe <kehoea@parhasard.net>
* fileio.c (Finsert_file_contents_internal):
Only call format-decode if it has a function binding.
(build_annotations): Only call format-annotate-function if it has
a function binding; incidentally only calling #'car-less-than-car
if *it* has a function binding.
(syms_of_fileio): #'car-less-than-car and #'cdr-less-than-cdr are
now in Lisp.
lisp/ChangeLog addition:
2010-02-07 Aidan Kehoe <kehoea@parhasard.net>
* make-docfile.el (format-decode): Remove this temporary function
definition, now we check the symbol is bound in fileio.c
* version.el (format-decode): Ditto.
* format.el (car-less-than-car, cdr-less-than-cdr): Move these
here from fileio.c, now they are only called once format.el is
available.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 07 Feb 2010 23:31:50 +0000 |
parents | 44d7bde26046 |
children | 2e528066e2fc |
comparison
equal
deleted
inserted
replaced
5003:6b6b0f8ab749 | 5004:788c38f20376 |
---|---|
3266 report_file_error ("Opening input file", | 3266 report_file_error ("Opening input file", |
3267 filename); | 3267 filename); |
3268 } | 3268 } |
3269 | 3269 |
3270 /* Decode file format */ | 3270 /* Decode file format */ |
3271 if (inserted > 0) | 3271 if (inserted > 0 && !UNBOUNDP (XSYMBOL_FUNCTION (Qformat_decode))) |
3272 { | 3272 { |
3273 Lisp_Object insval = call3 (Qformat_decode, | 3273 Lisp_Object insval = call3 (Qformat_decode, Qnil, make_int (inserted), |
3274 Qnil, make_int (inserted), visit); | 3274 visit); |
3275 CHECK_INT (insval); | 3275 CHECK_INT (insval); |
3276 inserted = XINT (insval); | 3276 inserted = XINT (insval); |
3277 } | 3277 } |
3278 | 3278 |
3279 if (inserted > 0) | 3279 if (inserted > 0) |
3626 NUNGCPRO; | 3626 NUNGCPRO; |
3627 UNGCPRO; | 3627 UNGCPRO; |
3628 return Qnil; | 3628 return Qnil; |
3629 } | 3629 } |
3630 | 3630 |
3631 /* #### This is such a load of shit!!!! There is no way we should define | |
3632 something so stupid as a subr, just sort the fucking list more | |
3633 intelligently. */ | |
3634 DEFUN ("car-less-than-car", Fcar_less_than_car, 2, 2, 0, /* | |
3635 Return t if (car A) is numerically less than (car B). | |
3636 */ | |
3637 (a, b)) | |
3638 { | |
3639 Lisp_Object objs[2]; | |
3640 objs[0] = Fcar (a); | |
3641 objs[1] = Fcar (b); | |
3642 return Flss (2, objs); | |
3643 } | |
3644 | |
3645 /* Heh heh heh, let's define this too, just to aggravate the person who | |
3646 wrote the above comment. */ | |
3647 DEFUN ("cdr-less-than-cdr", Fcdr_less_than_cdr, 2, 2, 0, /* | |
3648 Return t if (cdr A) is numerically less than (cdr B). | |
3649 */ | |
3650 (a, b)) | |
3651 { | |
3652 Lisp_Object objs[2]; | |
3653 objs[0] = Fcdr (a); | |
3654 objs[1] = Fcdr (b); | |
3655 return Flss (2, objs); | |
3656 } | |
3657 | |
3658 /* Build the complete list of annotations appropriate for writing out | 3631 /* Build the complete list of annotations appropriate for writing out |
3659 the text between START and END, by calling all the functions in | 3632 the text between START and END, by calling all the functions in |
3660 write-region-annotate-functions and merging the lists they return. | 3633 write-region-annotate-functions and merging the lists they return. |
3661 If one of these functions switches to a different buffer, we assume | 3634 If one of these functions switches to a different buffer, we assume |
3662 that buffer contains altered text. Therefore, the caller must | 3635 that buffer contains altered text. Therefore, the caller must |
3696 annotations = merge (annotations, res, Qcar_less_than_car); | 3669 annotations = merge (annotations, res, Qcar_less_than_car); |
3697 p = Fcdr (p); | 3670 p = Fcdr (p); |
3698 } | 3671 } |
3699 | 3672 |
3700 /* Now do the same for annotation functions implied by the file-format */ | 3673 /* Now do the same for annotation functions implied by the file-format */ |
3701 if (auto_saving && (!EQ (Vauto_save_file_format, Qt))) | 3674 if (UNBOUNDP (XSYMBOL_FUNCTION (Qformat_annotate_function))) |
3702 p = Vauto_save_file_format; | 3675 { |
3676 p = Qnil; | |
3677 } | |
3678 else if (auto_saving && (!EQ (Vauto_save_file_format, Qt))) | |
3679 { | |
3680 p = Vauto_save_file_format; | |
3681 } | |
3703 else | 3682 else |
3704 p = current_buffer->file_format; | 3683 { |
3684 p = current_buffer->file_format; | |
3685 } | |
3686 | |
3705 while (!NILP (p)) | 3687 while (!NILP (p)) |
3706 { | 3688 { |
3707 struct buffer *given_buffer = current_buffer; | 3689 struct buffer *given_buffer = current_buffer; |
3708 Vwrite_region_annotations_so_far = annotations; | 3690 Vwrite_region_annotations_so_far = annotations; |
3709 res = call4 (Qformat_annotate_function, Fcar (p), start, end, | 3691 res = call4 (Qformat_annotate_function, Fcar (p), start, end, |
3716 } | 3698 } |
3717 Flength (res); | 3699 Flength (res); |
3718 annotations = merge (annotations, res, Qcar_less_than_car); | 3700 annotations = merge (annotations, res, Qcar_less_than_car); |
3719 p = Fcdr (p); | 3701 p = Fcdr (p); |
3720 } | 3702 } |
3703 | |
3721 UNGCPRO; | 3704 UNGCPRO; |
3722 return annotations; | 3705 return annotations; |
3723 } | 3706 } |
3724 | 3707 |
3725 /* Write to stream OUTSTREAM the characters from INSTREAM (it is read until | 3708 /* Write to stream OUTSTREAM the characters from INSTREAM (it is read until |
4437 DEFSUBR (Fdefault_file_modes); | 4420 DEFSUBR (Fdefault_file_modes); |
4438 DEFSUBR (Funix_sync); | 4421 DEFSUBR (Funix_sync); |
4439 DEFSUBR (Ffile_newer_than_file_p); | 4422 DEFSUBR (Ffile_newer_than_file_p); |
4440 DEFSUBR (Finsert_file_contents_internal); | 4423 DEFSUBR (Finsert_file_contents_internal); |
4441 DEFSUBR (Fwrite_region_internal); | 4424 DEFSUBR (Fwrite_region_internal); |
4442 DEFSUBR (Fcar_less_than_car); /* Vomitous! */ | |
4443 DEFSUBR (Fcdr_less_than_cdr); /* Yeah oh yeah bucko .... */ | |
4444 #if 0 | 4425 #if 0 |
4445 DEFSUBR (Fencrypt_string); | 4426 DEFSUBR (Fencrypt_string); |
4446 DEFSUBR (Fdecrypt_string); | 4427 DEFSUBR (Fdecrypt_string); |
4447 #endif | 4428 #endif |
4448 DEFSUBR (Fverify_visited_file_modtime); | 4429 DEFSUBR (Fverify_visited_file_modtime); |