changeset 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 6b6b0f8ab749
children 4170f3809a28
files lisp/ChangeLog lisp/make-docfile.el lisp/subr.el lisp/version.el src/ChangeLog src/fileio.c
diffstat 6 files changed, 51 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Feb 07 14:37:35 2010 +0000
+++ b/lisp/ChangeLog	Sun Feb 07 23:31:50 2010 +0000
@@ -1,3 +1,12 @@
+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.
+
 2010-02-07  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* setup-paths.el (paths-find-emacs-roots)
--- a/lisp/make-docfile.el	Sun Feb 07 14:37:35 2010 +0000
+++ b/lisp/make-docfile.el	Sun Feb 07 23:31:50 2010 +0000
@@ -78,11 +78,6 @@
 
 ;; (message (concat "Options: " (prin1-to-string options)))
 
-;; insert-file-contents-internal calls out to `format-decode' afterwards,
-;; so it must be defined.  if non-zero, it tries to do a bunch more stuff
-;; so say, "NOOOOOOOOOOOOO!  Basta!  Ca soufit!   Enough, already, OK?"
-(defun format-decode (fuck me harder) 0)
-
 ;; Next process the list of C files.
 (defun process-args (args)
   (while args
--- a/lisp/subr.el	Sun Feb 07 14:37:35 2010 +0000
+++ b/lisp/subr.el	Sun Feb 07 23:31:50 2010 +0000
@@ -1777,4 +1777,19 @@
           'many)
          (t (subr-max-args subr)))))
 
+;; XEmacs; move these here from C. Would be nice to drop them entirely, but
+;; they're used reasonably often, since they've been around for a long time
+;; and they're portable to GNU.
+
+;; Used in fileio.c if format-annotate-function has a function binding
+;; (which it won't have before this file is loaded):
+(defun car-less-than-car (a b)
+  "Return t if the car of A is numerically less than the car of B."
+  (< (car a) (car b)))
+
+;; Used in packages.
+(defun cdr-less-than-cdr (a b)
+  "Return t if (cdr A) is numerically less than (cdr B)."
+  (< (cdr a) (cdr b)))
+
 ;;; subr.el ends here
--- a/lisp/version.el	Sun Feb 07 14:37:35 2010 +0000
+++ b/lisp/version.el	Sun Feb 07 23:31:50 2010 +0000
@@ -152,9 +152,6 @@
   (save-current-buffer
     (set-buffer (get-buffer-create (generate-new-buffer-name
 				    " *temp*")))
-    ;; insert-file-contents-internal bogusly calls
-    ;; format-decode without checking if it's defined.
-    (fset 'format-decode #'(lambda (f l &optional v) l))
     (insert-file-contents-internal
      (expand-file-name "Installation" build-directory)
      ;; Relies on our working out the system coding system
@@ -164,7 +161,6 @@
      ;; mule/general-late.el, after all the dumped coding systems have been
      ;; loaded.
      'binary)
-    (fmakunbound 'format-decode)
     (prog1 (buffer-substring)
       (kill-buffer (current-buffer))))
   "Description of XEmacs installation.
@@ -175,4 +171,4 @@
 occasionally used, in a way the XEmacs developers don't endorse, to work out
 version information.  ")
 
-;;; version.el ends here
\ No newline at end of file
+;;; version.el ends here
--- a/src/ChangeLog	Sun Feb 07 14:37:35 2010 +0000
+++ b/src/ChangeLog	Sun Feb 07 23:31:50 2010 +0000
@@ -1,3 +1,13 @@
+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.
+
 2010-02-07  Ben Wing  <ben@xemacs.org>
 
 	* fns.c: Qlist, Qstring mistakenly declared twice.
--- 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);