Mercurial > emacs
comparison src/coding.c @ 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 | 80fb4c061e99 |
children | 72d8a45f6c9f |
comparison
equal
deleted
inserted
replaced
90271:6ef33f7b3f3c | 90272:f1df126ec7de |
---|---|
322 Lisp_Object Qstart_process, Qopen_network_stream; | 322 Lisp_Object Qstart_process, Qopen_network_stream; |
323 Lisp_Object Qtarget_idx; | 323 Lisp_Object Qtarget_idx; |
324 | 324 |
325 Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source; | 325 Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source; |
326 Lisp_Object Qinterrupted, Qinsufficient_memory; | 326 Lisp_Object Qinterrupted, Qinsufficient_memory; |
327 | |
328 /* If a symbol has this property, evaluate the value to define the | |
329 symbol as a coding system. */ | |
330 static Lisp_Object Qcoding_system_define_form; | |
327 | 331 |
328 int coding_system_require_warning; | 332 int coding_system_require_warning; |
329 | 333 |
330 Lisp_Object Vselect_safe_coding_system_function; | 334 Lisp_Object Vselect_safe_coding_system_function; |
331 | 335 |
7058 See the documentation of `define-coding-system' for information | 7062 See the documentation of `define-coding-system' for information |
7059 about coding-system objects. */) | 7063 about coding-system objects. */) |
7060 (obj) | 7064 (obj) |
7061 Lisp_Object obj; | 7065 Lisp_Object obj; |
7062 { | 7066 { |
7063 return ((NILP (obj) || CODING_SYSTEM_P (obj)) ? Qt : Qnil); | 7067 if (NILP (obj) |
7068 || CODING_SYSTEM_ID (obj) >= 0) | |
7069 return Qt; | |
7070 if (! SYMBOLP (obj) | |
7071 || NILP (Fget (obj, Qcoding_system_define_form))) | |
7072 return Qnil; | |
7073 return Qt; | |
7064 } | 7074 } |
7065 | 7075 |
7066 DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, | 7076 DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, |
7067 Sread_non_nil_coding_system, 1, 1, 0, | 7077 Sread_non_nil_coding_system, 1, 1, 0, |
7068 doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */) | 7078 doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */) |
7101 It is valid if it is nil or a symbol defined as a coding system by the | 7111 It is valid if it is nil or a symbol defined as a coding system by the |
7102 function `define-coding-system'. */) | 7112 function `define-coding-system'. */) |
7103 (coding_system) | 7113 (coding_system) |
7104 Lisp_Object coding_system; | 7114 Lisp_Object coding_system; |
7105 { | 7115 { |
7106 CHECK_SYMBOL (coding_system); | 7116 Lisp_Object define_form; |
7117 | |
7118 define_form = Fget (coding_system, Qcoding_system_define_form); | |
7119 if (! NILP (define_form)) | |
7120 { | |
7121 Fput (coding_system, Qcoding_system_define_form, Qnil); | |
7122 safe_eval (define_form); | |
7123 } | |
7107 if (!NILP (Fcoding_system_p (coding_system))) | 7124 if (!NILP (Fcoding_system_p (coding_system))) |
7108 return coding_system; | 7125 return coding_system; |
7109 while (1) | 7126 while (1) |
7110 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil)); | 7127 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil)); |
7111 } | 7128 } |
9320 DEFSYM (Qinsufficient_source, "insufficient-source"); | 9337 DEFSYM (Qinsufficient_source, "insufficient-source"); |
9321 DEFSYM (Qinconsistent_eol, "inconsistent-eol"); | 9338 DEFSYM (Qinconsistent_eol, "inconsistent-eol"); |
9322 DEFSYM (Qinvalid_source, "invalid-source"); | 9339 DEFSYM (Qinvalid_source, "invalid-source"); |
9323 DEFSYM (Qinterrupted, "interrupted"); | 9340 DEFSYM (Qinterrupted, "interrupted"); |
9324 DEFSYM (Qinsufficient_memory, "insufficient-memory"); | 9341 DEFSYM (Qinsufficient_memory, "insufficient-memory"); |
9342 DEFSYM (Qcoding_system_define_form, "coding-system-define-form"); | |
9325 | 9343 |
9326 defsubr (&Scoding_system_p); | 9344 defsubr (&Scoding_system_p); |
9327 defsubr (&Sread_coding_system); | 9345 defsubr (&Sread_coding_system); |
9328 defsubr (&Sread_non_nil_coding_system); | 9346 defsubr (&Sread_non_nil_coding_system); |
9329 defsubr (&Scheck_coding_system); | 9347 defsubr (&Scheck_coding_system); |