changeset 90272:f1df126ec7de

Sync to HEAD for handling autoload-coding-system. (Qcoding_system_define_form): New variable. (syms_of_coding): Intern and staticpro it. (Fcoding_system_p): Check Qcoding_system_define_form. (Fcheck_coding_system): Try to autoload the definition of CODING-SYSTEM.
author Kenichi Handa <handa@m17n.org>
date Thu, 19 Jan 2006 07:20:52 +0000
parents 6ef33f7b3f3c
children fdbfce97e78c
files src/coding.c
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Thu Jan 19 07:20:36 2006 +0000
+++ b/src/coding.c	Thu Jan 19 07:20:52 2006 +0000
@@ -325,6 +325,10 @@
 Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source;
 Lisp_Object Qinterrupted, Qinsufficient_memory;
 
+/* If a symbol has this property, evaluate the value to define the
+   symbol as a coding system.  */
+static Lisp_Object Qcoding_system_define_form;
+
 int coding_system_require_warning;
 
 Lisp_Object Vselect_safe_coding_system_function;
@@ -7060,7 +7064,13 @@
      (obj)
      Lisp_Object obj;
 {
-  return ((NILP (obj) || CODING_SYSTEM_P (obj)) ? Qt : Qnil);
+  if (NILP (obj)
+      || CODING_SYSTEM_ID (obj) >= 0)
+    return Qt;
+  if (! SYMBOLP (obj)
+      || NILP (Fget (obj, Qcoding_system_define_form)))
+    return Qnil;
+  return Qt;
 }
 
 DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system,
@@ -7103,7 +7113,14 @@
   (coding_system)
      Lisp_Object coding_system;
 {
-  CHECK_SYMBOL (coding_system);
+  Lisp_Object define_form;
+
+  define_form = Fget (coding_system, Qcoding_system_define_form);
+  if (! NILP (define_form))
+    {
+      Fput (coding_system, Qcoding_system_define_form, Qnil);
+      safe_eval (define_form);
+    }
   if (!NILP (Fcoding_system_p (coding_system)))
     return coding_system;
   while (1)
@@ -9322,6 +9339,7 @@
   DEFSYM (Qinvalid_source, "invalid-source");
   DEFSYM (Qinterrupted, "interrupted");
   DEFSYM (Qinsufficient_memory, "insufficient-memory");
+  DEFSYM (Qcoding_system_define_form, "coding-system-define-form");
 
   defsubr (&Scoding_system_p);
   defsubr (&Sread_coding_system);