Index: plug-ins/script-fu/scripts/plug-in-compat.init
===================================================================
--- plug-ins/script-fu/scripts/plug-in-compat.init	(revision 0)
+++ plug-ins/script-fu/scripts/plug-in-compat.init	(revision 0)
@@ -0,0 +1,24 @@
+; The Scheme code in this file provides some compatibility with
+; scripts that were originally written for use with older versions of
+; GIMP.
+;
+; It provides PDB procedures that used to be provided by plug-ins that
+; were since then removed from the GIMP distribution. You should not
+; use these in newly written scripts as the functions defined here may
+; be removed at some later date.
+
+
+(define (plug-in-color-map run-mode img layer
+			   src-color-1 src-color-2 dest-color-1 dest-color-2
+			   map-mode)
+  (let* ()
+    (gimp-levels layer HISTOGRAM-RED
+		 (car src-color-1) (car src-color-2) 1.0
+		 (- 255 (car dest-color-1)) (- 255 (car dest-color-2)))
+    (gimp-levels layer HISTOGRAM-GREEN
+		 (cadr src-color-1) (cadr src-color-2) 1.0
+		 (- 255 (cadr dest-color-1)) (- 255 (cadr dest-color-2)))
+    (gimp-levels layer HISTOGRAM-BLUE
+		 (caddr src-color-1) (caddr src-color-2) 1.0
+		 (- 255 (caddr dest-color-1)) (- 255 (caddr dest-color-2)))
+    (gimp-levels layer HISTOGRAM-VALUE 0 255 1.0 255 0)))
Index: plug-ins/script-fu/scripts/Makefile.am
===================================================================
--- plug-ins/script-fu/scripts/Makefile.am	(revision 27681)
+++ plug-ins/script-fu/scripts/Makefile.am	(working copy)
@@ -7,6 +7,7 @@ scriptdatadir = $(gimpdatadir)/scripts
 scripts = \
 	script-fu.init			\
 	script-fu-compat.init		\
+	plug-in-compat.init		\
 	3d-outline.scm			\
 	3dTruchet.scm			\
 	add-bevel.scm			\
Index: plug-ins/script-fu/scheme-wrapper.c
===================================================================
--- plug-ins/script-fu/scheme-wrapper.c	(revision 27681)
+++ plug-ins/script-fu/scheme-wrapper.c	(working copy)
@@ -68,6 +68,8 @@ static pointer  script_fu_quit_call     
 static pointer  script_fu_nil_call               (scheme    *sc,
                                                   pointer    a);
 
+static gboolean ts_load_file                     (const gchar *dirname,
+                                                  const gchar *basename);
 
 typedef struct
 {
@@ -239,30 +241,17 @@ tinyscheme_init (const gchar *path,
 
       for (list = dir_list; list; list = g_list_next (list))
         {
-          gchar *filename = g_build_filename (list->data,
-                                              "script-fu.init", NULL);
-          FILE  *fin      = g_fopen (filename, "rb");
-
-          g_free (filename);
-
-          if (fin)
+          if (ts_load_file (list->data, "script-fu.init"))
             {
-              scheme_load_file (&sc, fin);
-              fclose (fin);
-
               /*  To improve compatibility with older Script-Fu scripts,
                *  load script-fu-compat.init from the same directory.
                */
-              filename = g_build_filename (list->data,
-                                           "script-fu-compat.init", NULL);
-              fin = g_fopen (filename, "rb");
-              g_free (filename);
+              ts_load_file (list->data, "script-fu-compat.init");
 
-              if (fin)
-                {
-                  scheme_load_file (&sc, fin);
-                  fclose (fin);
-                }
+              /*  To improve compatibility with older GIMP version,
+               *  load plug-in-compat.init from the same directory.
+               */
+              ts_load_file (list->data, "plug-in-compat.init");
 
               break;
             }
@@ -578,6 +567,30 @@ ts_init_procedures (scheme   *sc,
   g_free (proc_list);
 }
 
+static gboolean
+ts_load_file (const gchar *dirname,
+              const gchar *basename)
+{
+  gchar *filename;
+  FILE  *fin;
+
+  filename = g_build_filename (dirname, basename, NULL);
+
+  fin = g_fopen (filename, "rb");
+
+  g_free (filename);
+
+  if (fin)
+    {
+      scheme_load_file (&sc, fin);
+      fclose (fin);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 static void
 convert_string (gchar *str)
 {
