diff 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
line wrap: on
line diff
--- a/src/fileio.c	Sun Feb 07 14:37:35 2010 +0000
+++ b/src/fileio.c	Sun Feb 07 23:31:50 2010 +0000
@@ -3268,10 +3268,10 @@
     }
 
   /* Decode file format */
-  if (inserted > 0)
+  if (inserted > 0 && !UNBOUNDP (XSYMBOL_FUNCTION (Qformat_decode)))
     {
-      Lisp_Object insval = call3 (Qformat_decode,
-                                  Qnil, make_int (inserted), visit);
+      Lisp_Object insval = call3 (Qformat_decode, Qnil, make_int (inserted),
+				  visit);
       CHECK_INT (insval);
       inserted = XINT (insval);
     }
@@ -3628,33 +3628,6 @@
   return Qnil;
 }
 
-/* #### This is such a load of shit!!!!  There is no way we should define
-   something so stupid as a subr, just sort the fucking list more
-   intelligently. */
-DEFUN ("car-less-than-car", Fcar_less_than_car, 2, 2, 0, /*
-Return t if (car A) is numerically less than (car B).
-*/
-       (a, b))
-{
-  Lisp_Object objs[2];
-  objs[0] = Fcar (a);
-  objs[1] = Fcar (b);
-  return Flss (2, objs);
-}
-
-/* Heh heh heh, let's define this too, just to aggravate the person who
-   wrote the above comment. */
-DEFUN ("cdr-less-than-cdr", Fcdr_less_than_cdr, 2, 2, 0, /*
-Return t if (cdr A) is numerically less than (cdr B).
-*/
-       (a, b))
-{
-  Lisp_Object objs[2];
-  objs[0] = Fcdr (a);
-  objs[1] = Fcdr (b);
-  return Flss (2, objs);
-}
-
 /* Build the complete list of annotations appropriate for writing out
    the text between START and END, by calling all the functions in
    write-region-annotate-functions and merging the lists they return.
@@ -3698,10 +3671,19 @@
     }
 
   /* Now do the same for annotation functions implied by the file-format */
-  if (auto_saving && (!EQ (Vauto_save_file_format, Qt)))
-    p = Vauto_save_file_format;
+  if (UNBOUNDP (XSYMBOL_FUNCTION (Qformat_annotate_function)))
+    {
+      p = Qnil;
+    }
+  else if (auto_saving && (!EQ (Vauto_save_file_format, Qt)))
+    {
+      p = Vauto_save_file_format;
+    }
   else
-    p = current_buffer->file_format;
+    {
+      p = current_buffer->file_format;
+    }
+
   while (!NILP (p))
     {
       struct buffer *given_buffer = current_buffer;
@@ -3718,6 +3700,7 @@
       annotations = merge (annotations, res, Qcar_less_than_car);
       p = Fcdr (p);
     }
+
   UNGCPRO;
   return annotations;
 }
@@ -4439,8 +4422,6 @@
   DEFSUBR (Ffile_newer_than_file_p);
   DEFSUBR (Finsert_file_contents_internal);
   DEFSUBR (Fwrite_region_internal);
-  DEFSUBR (Fcar_less_than_car); /* Vomitous! */
-  DEFSUBR (Fcdr_less_than_cdr); /* Yeah oh yeah bucko .... */
 #if 0
   DEFSUBR (Fencrypt_string);
   DEFSUBR (Fdecrypt_string);