]> code.delx.au - gnu-emacs/commitdiff
Merge from emacs--devo--0
authorMiles Bader <miles@gnu.org>
Wed, 7 Jun 2006 18:05:10 +0000 (18:05 +0000)
committerMiles Bader <miles@gnu.org>
Wed, 7 Jun 2006 18:05:10 +0000 (18:05 +0000)
Patches applied:

 * emacs--devo--0  (patch 285-296)

   - Update from CVS
   - Merge from gnus--rel--5.10
   - Update from CVS: admin/FOR-RELEASE: Update refcard section.

 * gnus--rel--5.10  (patch 102-104)

   - Update from CVS

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64

58 files changed:
1  2 
configure
configure.in
etc/HELLO
etc/MORE.STUFF
etc/NEWS
etc/NEWS.19
etc/PROBLEMS
etc/TODO
lib-src/makefile.w32-in
lisp/ChangeLog
lisp/arc-mode.el
lisp/faces.el
lisp/gnus/mm-util.el
lisp/info.el
lisp/international/mule-cmds.el
lisp/international/mule.el
lisp/loadup.el
lisp/mail/rmail.el
lisp/makefile.w32-in
lisp/progmodes/sh-script.el
lisp/simple.el
lisp/startup.el
lisp/subr.el
lisp/term.el
lisp/term/mac-win.el
lisp/term/w32-win.el
lisp/term/x-win.el
lisp/textmodes/ispell.el
lisp/textmodes/sgml-mode.el
src/ChangeLog
src/Makefile.in
src/buffer.c
src/coding.c
src/config.in
src/dispextern.h
src/dispnew.c
src/emacs.c
src/fileio.c
src/fns.c
src/frame.c
src/intervals.c
src/lisp.h
src/lread.c
src/macfns.c
src/macgui.h
src/macterm.c
src/minibuf.c
src/process.c
src/search.c
src/w32fns.c
src/w32term.c
src/window.c
src/xdisp.c
src/xfaces.c
src/xfns.c
src/xmenu.c
src/xterm.c
src/xterm.h

diff --cc configure
index 6969f29fed43af9a1daecd3f4c328f1f6a3321b3,d72790133d7af89fe15496eff5242e30ed54b6de..c84eb76bdd5037d0ceee5d19ab143ea2e07b0dc5
+++ b/configure
@@@ -310,7 -310,7 +310,7 @@@ ac_includes_default="
  # include <unistd.h>
  #endif"
  
- ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO GZIP_PROG LIBSOUND SET_MAKE PKG_CONFIG GTK_CFLAGS GTK_LIBS XFT_CFLAGS XFT_LIBS FREETYPE_CFLAGS FREETYPE_LIBS FONTCONFIG_CFLAGS FONTCONFIG_LIBS HAVE_LIBOTF LIBOTF_CFLAGS LIBOTF_LIBS ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS GETOPT_H GETOPTOBJS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS'
 -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO GZIP_PROG LIBSOUND PKG_CONFIG ALSA_CFLAGS ALSA_LIBS CFLAGS_SOUND SET_MAKE GTK_CFLAGS GTK_LIBS ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS GETOPT_H GETOPTOBJS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS'
++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO GZIP_PROG LIBSOUND PKG_CONFIG ALSA_CFLAGS ALSA_LIBS CFLAGS_SOUND SET_MAKE GTK_CFLAGS GTK_LIBS XFT_CFLAGS XFT_LIBS FREETYPE_CFLAGS FREETYPE_LIBS FONTCONFIG_CFLAGS FONTCONFIG_LIBS HAVE_LIBOTF LIBOTF_CFLAGS LIBOTF_LIBS ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS GETOPT_H GETOPTOBJS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS'
  ac_subst_files=''
  
  # Initialize some variables set by options.
@@@ -24295,19 -23769,13 +24411,22 @@@ s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t 
  s,@INSTALL_INFO@,$INSTALL_INFO,;t t
  s,@GZIP_PROG@,$GZIP_PROG,;t t
  s,@LIBSOUND@,$LIBSOUND,;t t
- s,@SET_MAKE@,$SET_MAKE,;t t
  s,@PKG_CONFIG@,$PKG_CONFIG,;t t
+ s,@ALSA_CFLAGS@,$ALSA_CFLAGS,;t t
+ s,@ALSA_LIBS@,$ALSA_LIBS,;t t
+ s,@CFLAGS_SOUND@,$CFLAGS_SOUND,;t t
+ s,@SET_MAKE@,$SET_MAKE,;t t
  s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t
  s,@GTK_LIBS@,$GTK_LIBS,;t t
 +s,@XFT_CFLAGS@,$XFT_CFLAGS,;t t
 +s,@XFT_LIBS@,$XFT_LIBS,;t t
 +s,@FREETYPE_CFLAGS@,$FREETYPE_CFLAGS,;t t
 +s,@FREETYPE_LIBS@,$FREETYPE_LIBS,;t t
 +s,@FONTCONFIG_CFLAGS@,$FONTCONFIG_CFLAGS,;t t
 +s,@FONTCONFIG_LIBS@,$FONTCONFIG_LIBS,;t t
 +s,@HAVE_LIBOTF@,$HAVE_LIBOTF,;t t
 +s,@LIBOTF_CFLAGS@,$LIBOTF_CFLAGS,;t t
 +s,@LIBOTF_LIBS@,$LIBOTF_LIBS,;t t
  s,@ALLOCA@,$ALLOCA,;t t
  s,@liblockfile@,$liblockfile,;t t
  s,@LIBOBJS@,$LIBOBJS,;t t
diff --cc configure.in
Simple merge
diff --cc etc/HELLO
Simple merge
diff --cc etc/MORE.STUFF
Simple merge
diff --cc etc/NEWS
Simple merge
diff --cc etc/NEWS.19
index e92965c89d94805326c9492c5e60c2cc9e2c0c66,2d2e5f57066e712d08ecf32536721bdb3c264a28..ce06d2a8bfaddc88353c7589bc9eea1884afeb5d
@@@ -1029,7 -1039,7 +1039,7 @@@ your working file with the latest versi
  *** RCS customization.
  
  There is a new variable vc-consult-headers.  If it is t (the default),
- VC searches for RCS headers in working files (like `$Id: ONEWS,v 1.8 2003/02/04 14:30:40 lektu Exp $') and
 -VC searches for RCS headers in working files (like `$Id$') and
++VC searches for RCS headers in working files (like `$Id: NEWS.19,v 1.1 2006/06/04 01:01:51 kfstorm Exp $') and
  determines the state of the file from them, not from the master file.
  This is fast and more reliable when you use branches.  (The variable
  was already present in Emacs 19.29, but didn't get mentioned in the
diff --cc etc/PROBLEMS
Simple merge
diff --cc etc/TODO
Simple merge
Simple merge
diff --cc lisp/ChangeLog
Simple merge
Simple merge
diff --cc lisp/faces.el
Simple merge
Simple merge
diff --cc lisp/info.el
Simple merge
Simple merge
Simple merge
diff --cc lisp/loadup.el
Simple merge
Simple merge
Simple merge
index 0e73427a33cc42d46ab85b91499b5ea31dcd9f20,ef80d28c578c785cf9415947fc9a09aa70d02c73..b80fe4c0fbc4f6a739e66c152a8e6e19bc4bc8a5
@@@ -1019,11 -1088,12 +1088,12 @@@ This is used to flag quote characters i
      (")" 0 (sh-font-lock-paren (match-beginning 0)))))
  
  (defun sh-font-lock-syntactic-face-function (state)
-   (if (nth 3 state)
-       (if (characterp (nth 3 state))
-         font-lock-string-face
-       sh-heredoc-face)
-     font-lock-comment-face))
+   (let ((q (nth 3 state)))
+     (if q
 -        (if (char-valid-p q)
++        (if (characterp q)
+             (if (eq q ?\`) 'sh-quoted-exec font-lock-string-face)
+           sh-heredoc-face)
+       font-lock-comment-face)))
  
  (defgroup sh-indentation nil
    "Variables controlling indentation in shell scripts.
diff --cc lisp/simple.el
Simple merge
diff --cc lisp/startup.el
Simple merge
diff --cc lisp/subr.el
Simple merge
diff --cc lisp/term.el
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/ChangeLog
Simple merge
diff --cc src/Makefile.in
index 049a4c5bc17d718372bfc21412c32ba728213b61,4b6599dc26df1338feacf6b9c87533136d73a4de..342540df7be1365ebe03c6b8ba9c4a5524cd24a0
@@@ -281,7 -280,7 +281,7 @@@ TOOLKIT_DEFINES 
  
  /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
     since it may have -I options that should override those two.  */
- ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@
 -ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${CFLAGS}
++ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@
  .c.o:
        $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
  
diff --cc src/buffer.c
Simple merge
diff --cc src/coding.c
index debb2f27ffcae5d84e4048132605b6900f4ce2e5,be39ceb7fe6c50bfa2e7ba9b8fff163a1ac803f7..9f95c2c677798c7c377e405754d436bbc75da204
@@@ -8304,811 -7446,204 +8304,818 @@@ DECODING-SYSTEM is the coding system t
  \(in case OPERATION does decoding), and ENCODING-SYSTEM is the coding system
  for encoding (in case OPERATION does encoding).
  
 -The first argument OPERATION specifies an I/O primitive:
 -  For file I/O, `insert-file-contents' or `write-region'.
 -  For process I/O, `call-process', `call-process-region', or `start-process'.
 -  For network I/O, `open-network-stream'.
 +The first argument OPERATION specifies an I/O primitive:
 +  For file I/O, `insert-file-contents' or `write-region'.
 +  For process I/O, `call-process', `call-process-region', or `start-process'.
 +  For network I/O, `open-network-stream'.
 +
 +The remaining arguments should be the same arguments that were passed
 +to the primitive.  Depending on which primitive, one of those arguments
 +is selected as the TARGET.  For example, if OPERATION does file I/O,
 +whichever argument specifies the file name is TARGET.
 +
 +TARGET has a meaning which depends on OPERATION:
-   For file I/O, TARGET is a file name.
++  For file I/O, TARGET is a file name (except for the special case below).
 +  For process I/O, TARGET is a process name.
 +  For network I/O, TARGET is a service name or a port number
 +
 +This function looks up what specified for TARGET in,
 +`file-coding-system-alist', `process-coding-system-alist',
 +or `network-coding-system-alist' depending on OPERATION.
 +They may specify a coding system, a cons of coding systems,
 +or a function symbol to call.
 +In the last case, we call the function with one argument,
 +which is a list of all the arguments given to this function.
 +
++If OPERATION is `insert-file-contents', the argument corresponding to
++TARGET may be a cons (FILENAME . BUFFER).  In that case, FILENAME is a
++file name to look up, and BUFFER is a buffer that contains the file's
++contents (not yet decoded).  If `file-coding-system-alist' specifies a
++function to call for FILENAME, that function should examine the
++contents of BUFFER instead of reading the file.
++
 +usage: (find-operation-coding-system OPERATION ARGUMENTS ...)  */)
 +     (nargs, args)
 +     int nargs;
 +     Lisp_Object *args;
 +{
 +  Lisp_Object operation, target_idx, target, val;
 +  register Lisp_Object chain;
 +
 +  if (nargs < 2)
 +    error ("Too few arguments");
 +  operation = args[0];
 +  if (!SYMBOLP (operation)
 +      || !INTEGERP (target_idx = Fget (operation, Qtarget_idx)))
 +    error ("Invalid first arguement");
 +  if (nargs < 1 + XINT (target_idx))
 +    error ("Too few arguments for operation: %s",
 +         SDATA (SYMBOL_NAME (operation)));
 +  target = args[XINT (target_idx) + 1];
 +  if (!(STRINGP (target)
 +      || (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
 +    error ("Invalid %dth argument", XINT (target_idx) + 1);
 +
 +  chain = ((EQ (operation, Qinsert_file_contents)
 +          || EQ (operation, Qwrite_region))
 +         ? Vfile_coding_system_alist
 +         : (EQ (operation, Qopen_network_stream)
 +            ? Vnetwork_coding_system_alist
 +            : Vprocess_coding_system_alist));
 +  if (NILP (chain))
 +    return Qnil;
 +
 +  for (; CONSP (chain); chain = XCDR (chain))
 +    {
 +      Lisp_Object elt;
 +
 +      elt = XCAR (chain);
 +      if (CONSP (elt)
 +        && ((STRINGP (target)
 +             && STRINGP (XCAR (elt))
 +             && fast_string_match (XCAR (elt), target) >= 0)
 +            || (INTEGERP (target) && EQ (target, XCAR (elt)))))
 +      {
 +        val = XCDR (elt);
 +        /* Here, if VAL is both a valid coding system and a valid
 +             function symbol, we return VAL as a coding system.  */
 +        if (CONSP (val))
 +          return val;
 +        if (! SYMBOLP (val))
 +          return Qnil;
 +        if (! NILP (Fcoding_system_p (val)))
 +          return Fcons (val, val);
 +        if (! NILP (Ffboundp (val)))
 +          {
-             val = call1 (val, Flist (nargs, args));
++            val = safe_call1 (val, Flist (nargs, args));
 +            if (CONSP (val))
 +              return val;
 +            if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val)))
 +              return Fcons (val, val);
 +          }
 +        return Qnil;
 +      }
 +    }
 +  return Qnil;
 +}
 +
 +DEFUN ("set-coding-system-priority", Fset_coding_system_priority,
 +       Sset_coding_system_priority, 0, MANY, 0,
 +       doc: /* Assign higher priority to the coding systems given as arguments.
 +If multiple coding systems belongs to the same category,
 +all but the first one are ignored.
 +
 +usage: (set-coding-system-priority ...)  */)
 +     (nargs, args)
 +     int nargs;
 +     Lisp_Object *args;
 +{
 +  int i, j;
 +  int changed[coding_category_max];
 +  enum coding_category priorities[coding_category_max];
 +
 +  bzero (changed, sizeof changed);
 +
 +  for (i = j = 0; i < nargs; i++)
 +    {
 +      enum coding_category category;
 +      Lisp_Object spec, attrs;
 +
 +      CHECK_CODING_SYSTEM_GET_SPEC (args[i], spec);
 +      attrs = AREF (spec, 0);
 +      category = XINT (CODING_ATTR_CATEGORY (attrs));
 +      if (changed[category])
 +      /* Ignore this coding system because a coding system of the
 +         same category already had a higher priority.  */
 +      continue;
 +      changed[category] = 1;
 +      priorities[j++] = category;
 +      if (coding_categories[category].id >= 0
 +        && ! EQ (args[i], CODING_ID_NAME (coding_categories[category].id)))
 +      setup_coding_system (args[i], &coding_categories[category]);
 +      Fset (AREF (Vcoding_category_table, category), args[i]);
 +    }
 +
 +  /* Now we have decided top J priorities.  Reflect the order of the
 +     original priorities to the remaining priorities.  */
 +
 +  for (i = j, j = 0; i < coding_category_max; i++, j++)
 +    {
 +      while (j < coding_category_max
 +           && changed[coding_priorities[j]])
 +      j++;
 +      if (j == coding_category_max)
 +      abort ();
 +      priorities[i] = coding_priorities[j];
 +    }
 +
 +  bcopy (priorities, coding_priorities, sizeof priorities);
 +
 +  /* Update `coding-category-list'.  */
 +  Vcoding_category_list = Qnil;
 +  for (i = coding_category_max - 1; i >= 0; i--)
 +    Vcoding_category_list
 +      = Fcons (AREF (Vcoding_category_table, priorities[i]),
 +             Vcoding_category_list);
 +
 +  return Qnil;
 +}
 +
 +DEFUN ("coding-system-priority-list", Fcoding_system_priority_list,
 +       Scoding_system_priority_list, 0, 1, 0,
 +       doc: /* Return a list of coding systems ordered by their priorities.
 +HIGHESTP non-nil means just return the highest priority one.  */)
 +     (highestp)
 +     Lisp_Object highestp;
 +{
 +  int i;
 +  Lisp_Object val;
 +
 +  for (i = 0, val = Qnil; i < coding_category_max; i++)
 +    {
 +      enum coding_category category = coding_priorities[i];
 +      int id = coding_categories[category].id;
 +      Lisp_Object attrs;
 +
 +      if (id < 0)
 +      continue;
 +      attrs = CODING_ID_ATTRS (id);
 +      if (! NILP (highestp))
 +      return CODING_ATTR_BASE_NAME (attrs);
 +      val = Fcons (CODING_ATTR_BASE_NAME (attrs), val);
 +    }
 +  return Fnreverse (val);
 +}
 +
 +static char *suffixes[] = { "-unix", "-dos", "-mac" };
 +
 +static Lisp_Object
 +make_subsidiaries (base)
 +     Lisp_Object base;
 +{
 +  Lisp_Object subsidiaries;
 +  int base_name_len = SBYTES (SYMBOL_NAME (base));
 +  char *buf = (char *) alloca (base_name_len + 6);
 +  int i;
 +
 +  bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len);
 +  subsidiaries = Fmake_vector (make_number (3), Qnil);
 +  for (i = 0; i < 3; i++)
 +    {
 +      bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1);
 +      ASET (subsidiaries, i, intern (buf));
 +    }
 +  return subsidiaries;
 +}
 +
 +
 +DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal,
 +       Sdefine_coding_system_internal, coding_arg_max, MANY, 0,
 +       doc: /* For internal use only.
 +usage: (define-coding-system-internal ...)  */)
 +     (nargs, args)
 +     int nargs;
 +     Lisp_Object *args;
 +{
 +  Lisp_Object name;
 +  Lisp_Object spec_vec;               /* [ ATTRS ALIASE EOL_TYPE ] */
 +  Lisp_Object attrs;          /* Vector of attributes.  */
 +  Lisp_Object eol_type;
 +  Lisp_Object aliases;
 +  Lisp_Object coding_type, charset_list, safe_charsets;
 +  enum coding_category category;
 +  Lisp_Object tail, val;
 +  int max_charset_id = 0;
 +  int i;
 +
 +  if (nargs < coding_arg_max)
 +    goto short_args;
 +
 +  attrs = Fmake_vector (make_number (coding_attr_last_index), Qnil);
 +
 +  name = args[coding_arg_name];
 +  CHECK_SYMBOL (name);
 +  CODING_ATTR_BASE_NAME (attrs) = name;
 +
 +  val = args[coding_arg_mnemonic];
 +  if (! STRINGP (val))
 +    CHECK_CHARACTER (val);
 +  CODING_ATTR_MNEMONIC (attrs) = val;
 +
 +  coding_type = args[coding_arg_coding_type];
 +  CHECK_SYMBOL (coding_type);
 +  CODING_ATTR_TYPE (attrs) = coding_type;
 +
 +  charset_list = args[coding_arg_charset_list];
 +  if (SYMBOLP (charset_list))
 +    {
 +      if (EQ (charset_list, Qiso_2022))
 +      {
 +        if (! EQ (coding_type, Qiso_2022))
 +          error ("Invalid charset-list");
 +        charset_list = Viso_2022_charset_list;
 +      }
 +      else if (EQ (charset_list, Qemacs_mule))
 +      {
 +        if (! EQ (coding_type, Qemacs_mule))
 +          error ("Invalid charset-list");
 +        charset_list = Vemacs_mule_charset_list;
 +      }
 +      for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
 +      if (max_charset_id < XFASTINT (XCAR (tail)))
 +        max_charset_id = XFASTINT (XCAR (tail));
 +    }
 +  else
 +    {
 +      charset_list = Fcopy_sequence (charset_list);
 +      for (tail = charset_list; !NILP (tail); tail = Fcdr (tail))
 +      {
 +        struct charset *charset;
 +
 +        val = Fcar (tail);
 +        CHECK_CHARSET_GET_CHARSET (val, charset);
 +        if (EQ (coding_type, Qiso_2022)
 +            ? CHARSET_ISO_FINAL (charset) < 0
 +            : EQ (coding_type, Qemacs_mule)
 +            ? CHARSET_EMACS_MULE_ID (charset) < 0
 +            : 0)
 +          error ("Can't handle charset `%s'",
 +                 SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
 +
 +        XSETCAR (tail, make_number (charset->id));
 +        if (max_charset_id < charset->id)
 +          max_charset_id = charset->id;
 +      }
 +    }
 +  CODING_ATTR_CHARSET_LIST (attrs) = charset_list;
 +
 +  safe_charsets = Fmake_string (make_number (max_charset_id + 1),
 +                              make_number (255));
 +  for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
 +    SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
 +  CODING_ATTR_SAFE_CHARSETS (attrs) = safe_charsets;
 +
 +  CODING_ATTR_ASCII_COMPAT (attrs) = args[coding_arg_ascii_compatible_p];
 +
 +  val = args[coding_arg_decode_translation_table];
 +  if (! CHAR_TABLE_P (val) && ! CONSP (val))
 +    CHECK_SYMBOL (val);
 +  CODING_ATTR_DECODE_TBL (attrs) = val;
 +
 +  val = args[coding_arg_encode_translation_table];
 +  if (! CHAR_TABLE_P (val) && ! CONSP (val))
 +    CHECK_SYMBOL (val);
 +  CODING_ATTR_ENCODE_TBL (attrs) = val;
 +
 +  val = args[coding_arg_post_read_conversion];
 +  CHECK_SYMBOL (val);
 +  CODING_ATTR_POST_READ (attrs) = val;
 +
 +  val = args[coding_arg_pre_write_conversion];
 +  CHECK_SYMBOL (val);
 +  CODING_ATTR_PRE_WRITE (attrs) = val;
 +
 +  val = args[coding_arg_default_char];
 +  if (NILP (val))
 +    CODING_ATTR_DEFAULT_CHAR (attrs) = make_number (' ');
 +  else
 +    {
 +      CHECK_CHARACTER (val);
 +      CODING_ATTR_DEFAULT_CHAR (attrs) = val;
 +    }
 +
 +  val = args[coding_arg_for_unibyte];
 +  CODING_ATTR_FOR_UNIBYTE (attrs) = NILP (val) ? Qnil : Qt;
 +
 +  val = args[coding_arg_plist];
 +  CHECK_LIST (val);
 +  CODING_ATTR_PLIST (attrs) = val;
 +
 +  if (EQ (coding_type, Qcharset))
 +    {
 +      /* Generate a lisp vector of 256 elements.  Each element is nil,
 +       integer, or a list of charset IDs.
 +
 +       If Nth element is nil, the byte code N is invalid in this
 +       coding system.
 +
 +       If Nth element is a number NUM, N is the first byte of a
 +       charset whose ID is NUM.
 +
 +       If Nth element is a list of charset IDs, N is the first byte
 +       of one of them.  The list is sorted by dimensions of the
 +       charsets.  A charset of smaller dimension comes firtst. */
 +      val = Fmake_vector (make_number (256), Qnil);
 +
 +      for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
 +      {
 +        struct charset *charset = CHARSET_FROM_ID (XFASTINT (XCAR (tail)));
 +        int dim = CHARSET_DIMENSION (charset);
 +        int idx = (dim - 1) * 4;
 +
 +        if (CHARSET_ASCII_COMPATIBLE_P (charset))
 +          CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
 +
 +        for (i = charset->code_space[idx];
 +             i <= charset->code_space[idx + 1]; i++)
 +          {
 +            Lisp_Object tmp, tmp2;
 +            int dim2;
 +
 +            tmp = AREF (val, i);
 +            if (NILP (tmp))
 +              tmp = XCAR (tail);
 +            else if (NUMBERP (tmp))
 +              {
 +                dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFASTINT (tmp)));
 +                if (dim < dim2)
 +                  tmp = Fcons (XCAR (tail), Fcons (tmp, Qnil));
 +                else
 +                  tmp = Fcons (tmp, Fcons (XCAR (tail), Qnil));
 +              }
 +            else
 +              {
 +                for (tmp2 = tmp; CONSP (tmp2); tmp2 = XCDR (tmp2))
 +                  {
 +                    dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFASTINT (XCAR (tmp2))));
 +                    if (dim < dim2)
 +                      break;
 +                  }
 +                if (NILP (tmp2))
 +                  tmp = nconc2 (tmp, Fcons (XCAR (tail), Qnil));
 +                else
 +                  {
 +                    XSETCDR (tmp2, Fcons (XCAR (tmp2), XCDR (tmp2)));
 +                    XSETCAR (tmp2, XCAR (tail));
 +                  }
 +              }
 +            ASET (val, i, tmp);
 +          }
 +      }
 +      ASET (attrs, coding_attr_charset_valids, val);
 +      category = coding_category_charset;
 +    }
 +  else if (EQ (coding_type, Qccl))
 +    {
 +      Lisp_Object valids;
 +
 +      if (nargs < coding_arg_ccl_max)
 +      goto short_args;
  
 -The remaining arguments should be the same arguments that were passed
 -to the primitive.  Depending on which primitive, one of those arguments
 -is selected as the TARGET.  For example, if OPERATION does file I/O,
 -whichever argument specifies the file name is TARGET.
 +      val = args[coding_arg_ccl_decoder];
 +      CHECK_CCL_PROGRAM (val);
 +      if (VECTORP (val))
 +      val = Fcopy_sequence (val);
 +      ASET (attrs, coding_attr_ccl_decoder, val);
  
 -TARGET has a meaning which depends on OPERATION:
 -  For file I/O, TARGET is a file name (except for the special case below).
 -  For process I/O, TARGET is a process name.
 -  For network I/O, TARGET is a service name or a port number
 +      val = args[coding_arg_ccl_encoder];
 +      CHECK_CCL_PROGRAM (val);
 +      if (VECTORP (val))
 +      val = Fcopy_sequence (val);
 +      ASET (attrs, coding_attr_ccl_encoder, val);
  
 -This function looks up what specified for TARGET in,
 -`file-coding-system-alist', `process-coding-system-alist',
 -or `network-coding-system-alist' depending on OPERATION.
 -They may specify a coding system, a cons of coding systems,
 -or a function symbol to call.
 -In the last case, we call the function with one argument,
 -which is a list of all the arguments given to this function.
 +      val = args[coding_arg_ccl_valids];
 +      valids = Fmake_string (make_number (256), make_number (0));
 +      for (tail = val; !NILP (tail); tail = Fcdr (tail))
 +      {
 +        int from, to;
  
 -If OPERATION is `insert-file-contents', the argument corresponding to
 -TARGET may be a cons (FILENAME . BUFFER).  In that case, FILENAME is a
 -file name to look up, and BUFFER is a buffer that contains the file's
 -contents (not yet decoded).  If `file-coding-system-alist' specifies a
 -function to call for FILENAME, that function should examine the
 -contents of BUFFER instead of reading the file.
 +        val = Fcar (tail);
 +        if (INTEGERP (val))
 +          {
 +            from = to = XINT (val);
 +            if (from < 0 || from > 255)
 +              args_out_of_range_3 (val, make_number (0), make_number (255));
 +          }
 +        else
 +          {
 +            CHECK_CONS (val);
 +            CHECK_NATNUM_CAR (val);
 +            CHECK_NATNUM_CDR (val);
 +            from = XINT (XCAR (val));
 +            if (from > 255)
 +              args_out_of_range_3 (XCAR (val),
 +                                   make_number (0), make_number (255));
 +            to = XINT (XCDR (val));
 +            if (to < from || to > 255)
 +              args_out_of_range_3 (XCDR (val),
 +                                   XCAR (val), make_number (255));
 +          }
 +        for (i = from; i <= to; i++)
 +          SSET (valids, i, 1);
 +      }
 +      ASET (attrs, coding_attr_ccl_valids, valids);
  
 -usage: (find-operation-coding-system OPERATION ARGUMENTS ...)  */)
 -     (nargs, args)
 -     int nargs;
 -     Lisp_Object *args;
 -{
 -  Lisp_Object operation, target_idx, target, val;
 -  register Lisp_Object chain;
 +      category = coding_category_ccl;
 +    }
 +  else if (EQ (coding_type, Qutf_16))
 +    {
 +      Lisp_Object bom, endian;
  
 -  if (nargs < 2)
 -    error ("Too few arguments");
 -  operation = args[0];
 -  if (!SYMBOLP (operation)
 -      || !INTEGERP (target_idx = Fget (operation, Qtarget_idx)))
 -    error ("Invalid first argument");
 -  if (nargs < 1 + XINT (target_idx))
 -    error ("Too few arguments for operation: %s",
 -         SDATA (SYMBOL_NAME (operation)));
 -  /* For write-region, if the 6th argument (i.e. VISIT, the 5th
 -     argument to write-region) is string, it must be treated as a
 -     target file name.  */
 -  if (EQ (operation, Qwrite_region)
 -      && nargs > 5
 -      && STRINGP (args[5]))
 -    target_idx = make_number (4);
 -  target = args[XINT (target_idx) + 1];
 -  if (!(STRINGP (target)
 -      || (EQ (operation, Qinsert_file_contents) && CONSP (target)
 -          && STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
 -      || (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
 -    error ("Invalid argument %d", XINT (target_idx) + 1);
 -  if (CONSP (target))
 -    target = XCAR (target);
 +      CODING_ATTR_ASCII_COMPAT (attrs) = Qnil;
  
 -  chain = ((EQ (operation, Qinsert_file_contents)
 -          || EQ (operation, Qwrite_region))
 -         ? Vfile_coding_system_alist
 -         : (EQ (operation, Qopen_network_stream)
 -            ? Vnetwork_coding_system_alist
 -            : Vprocess_coding_system_alist));
 -  if (NILP (chain))
 -    return Qnil;
 +      if (nargs < coding_arg_utf16_max)
 +      goto short_args;
  
 -  for (; CONSP (chain); chain = XCDR (chain))
 -    {
 -      Lisp_Object elt;
 -      elt = XCAR (chain);
 +      bom = args[coding_arg_utf16_bom];
 +      if (! NILP (bom) && ! EQ (bom, Qt))
 +      {
 +        CHECK_CONS (bom);
 +        val = XCAR (bom);
 +        CHECK_CODING_SYSTEM (val);
 +        val = XCDR (bom);
 +        CHECK_CODING_SYSTEM (val);
 +      }
 +      ASET (attrs, coding_attr_utf_16_bom, bom);
 +
 +      endian = args[coding_arg_utf16_endian];
 +      CHECK_SYMBOL (endian);
 +      if (NILP (endian))
 +      endian = Qbig;
 +      else if (! EQ (endian, Qbig) && ! EQ (endian, Qlittle))
 +      error ("Invalid endian: %s", SDATA (SYMBOL_NAME (endian)));
 +      ASET (attrs, coding_attr_utf_16_endian, endian);
 +
 +      category = (CONSP (bom)
 +                ? coding_category_utf_16_auto
 +                : NILP (bom)
 +                ? (EQ (endian, Qbig)
 +                   ? coding_category_utf_16_be_nosig
 +                   : coding_category_utf_16_le_nosig)
 +                : (EQ (endian, Qbig)
 +                   ? coding_category_utf_16_be
 +                   : coding_category_utf_16_le));
 +    }
 +  else if (EQ (coding_type, Qiso_2022))
 +    {
 +      Lisp_Object initial, reg_usage, request, flags;
 +      int i;
  
 -      if (CONSP (elt)
 -        && ((STRINGP (target)
 -             && STRINGP (XCAR (elt))
 -             && fast_string_match (XCAR (elt), target) >= 0)
 -            || (INTEGERP (target) && EQ (target, XCAR (elt)))))
 +      if (nargs < coding_arg_iso2022_max)
 +      goto short_args;
 +
 +      initial = Fcopy_sequence (args[coding_arg_iso2022_initial]);
 +      CHECK_VECTOR (initial);
 +      for (i = 0; i < 4; i++)
        {
 -        val = XCDR (elt);
 -        /* Here, if VAL is both a valid coding system and a valid
 -             function symbol, we return VAL as a coding system.  */
 -        if (CONSP (val))
 -          return val;
 -        if (! SYMBOLP (val))
 -          return Qnil;
 -        if (! NILP (Fcoding_system_p (val)))
 -          return Fcons (val, val);
 -        if (! NILP (Ffboundp (val)))
 +        val = Faref (initial, make_number (i));
 +        if (! NILP (val))
            {
 -            val = safe_call1 (val, Flist (nargs, args));
 -            if (CONSP (val))
 -              return val;
 -            if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val)))
 -              return Fcons (val, val);
 +            struct charset *charset;
 +
 +            CHECK_CHARSET_GET_CHARSET (val, charset);
 +            ASET (initial, i, make_number (CHARSET_ID (charset)));
 +            if (i == 0 && CHARSET_ASCII_COMPATIBLE_P (charset))
 +              CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
            }
 -        return Qnil;
 +        else
 +          ASET (initial, i, make_number (-1));
        }
 -    }
 -  return Qnil;
 -}
  
 -DEFUN ("update-coding-systems-internal",  Fupdate_coding_systems_internal,
 -       Supdate_coding_systems_internal, 0, 0, 0,
 -       doc: /* Update internal database for ISO2022 and CCL based coding systems.
 -When values of any coding categories are changed, you must
 -call this function.  */)
 -     ()
 -{
 -  int i;
 +      reg_usage = args[coding_arg_iso2022_reg_usage];
 +      CHECK_CONS (reg_usage);
 +      CHECK_NUMBER_CAR (reg_usage);
 +      CHECK_NUMBER_CDR (reg_usage);
  
 -  for (i = CODING_CATEGORY_IDX_EMACS_MULE; i < CODING_CATEGORY_IDX_MAX; i++)
 -    {
 -      Lisp_Object val;
 +      request = Fcopy_sequence (args[coding_arg_iso2022_request]);
 +      for (tail = request; ! NILP (tail); tail = Fcdr (tail))
 +      {
 +        int id;
 +        Lisp_Object tmp;
 +
 +        val = Fcar (tail);
 +        CHECK_CONS (val);
 +        tmp = XCAR (val);
 +        CHECK_CHARSET_GET_ID (tmp, id);
 +        CHECK_NATNUM_CDR (val);
 +        if (XINT (XCDR (val)) >= 4)
 +          error ("Invalid graphic register number: %d", XINT (XCDR (val)));
 +        XSETCAR (val, make_number (id));
 +      }
  
 -      val = SYMBOL_VALUE (XVECTOR (Vcoding_category_table)->contents[i]);
 -      if (!NILP (val))
 +      flags = args[coding_arg_iso2022_flags];
 +      CHECK_NATNUM (flags);
 +      i = XINT (flags);
 +      if (EQ (args[coding_arg_charset_list], Qiso_2022))
 +      flags = make_number (i | CODING_ISO_FLAG_FULL_SUPPORT);
 +
 +      ASET (attrs, coding_attr_iso_initial, initial);
 +      ASET (attrs, coding_attr_iso_usage, reg_usage);
 +      ASET (attrs, coding_attr_iso_request, request);
 +      ASET (attrs, coding_attr_iso_flags, flags);
 +      setup_iso_safe_charsets (attrs);
 +
 +      if (i & CODING_ISO_FLAG_SEVEN_BITS)
 +      category = ((i & (CODING_ISO_FLAG_LOCKING_SHIFT
 +                        | CODING_ISO_FLAG_SINGLE_SHIFT))
 +                  ? coding_category_iso_7_else
 +                  : EQ (args[coding_arg_charset_list], Qiso_2022)
 +                  ? coding_category_iso_7
 +                  : coding_category_iso_7_tight);
 +      else
        {
 -        if (! coding_system_table[i])
 -          coding_system_table[i] = ((struct coding_system *)
 -                                    xmalloc (sizeof (struct coding_system)));
 -        setup_coding_system (val, coding_system_table[i]);
 +        int id = XINT (AREF (initial, 1));
 +
 +        category = (((i & CODING_ISO_FLAG_LOCKING_SHIFT)
 +                     || EQ (args[coding_arg_charset_list], Qiso_2022)
 +                     || id < 0)
 +                    ? coding_category_iso_8_else
 +                    : (CHARSET_DIMENSION (CHARSET_FROM_ID (id)) == 1)
 +                    ? coding_category_iso_8_1
 +                    : coding_category_iso_8_2);
        }
 -      else if (coding_system_table[i])
 +      if (category != coding_category_iso_8_1
 +        && category != coding_category_iso_8_2)
 +      CODING_ATTR_ASCII_COMPAT (attrs) = Qnil;
 +    }
 +  else if (EQ (coding_type, Qemacs_mule))
 +    {
 +      if (EQ (args[coding_arg_charset_list], Qemacs_mule))
 +      ASET (attrs, coding_attr_emacs_mule_full, Qt);
 +      CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
 +      category = coding_category_emacs_mule;
 +    }
 +  else if (EQ (coding_type, Qshift_jis))
 +    {
 +
 +      struct charset *charset;
 +
 +      if (XINT (Flength (charset_list)) != 3
 +        && XINT (Flength (charset_list)) != 4)
 +      error ("There should be three or four charsets");
 +
 +      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
 +      if (CHARSET_DIMENSION (charset) != 1)
 +      error ("Dimension of charset %s is not one",
 +             SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
 +      if (CHARSET_ASCII_COMPATIBLE_P (charset))
 +      CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
 +
 +      charset_list = XCDR (charset_list);
 +      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
 +      if (CHARSET_DIMENSION (charset) != 1)
 +      error ("Dimension of charset %s is not one",
 +             SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
 +
 +      charset_list = XCDR (charset_list);
 +      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
 +      if (CHARSET_DIMENSION (charset) != 2)
 +      error ("Dimension of charset %s is not two",
 +             SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
 +
 +      charset_list = XCDR (charset_list);
 +      if (! NILP (charset_list))
        {
 -        xfree (coding_system_table[i]);
 -        coding_system_table[i] = NULL;
 +        charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
 +        if (CHARSET_DIMENSION (charset) != 2)
 +          error ("Dimension of charset %s is not two",
 +                 SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
        }
 +
 +      category = coding_category_sjis;
 +      Vsjis_coding_system = name;
      }
 +  else if (EQ (coding_type, Qbig5))
 +    {
 +      struct charset *charset;
  
 -  return Qnil;
 -}
 +      if (XINT (Flength (charset_list)) != 2)
 +      error ("There should be just two charsets");
  
 -DEFUN ("set-coding-priority-internal", Fset_coding_priority_internal,
 -       Sset_coding_priority_internal, 0, 0, 0,
 -       doc: /* Update internal database for the current value of `coding-category-list'.
 -This function is internal use only.  */)
 -     ()
 -{
 -  int i = 0, idx;
 -  Lisp_Object val;
 +      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
 +      if (CHARSET_DIMENSION (charset) != 1)
 +      error ("Dimension of charset %s is not one",
 +             SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
 +      if (CHARSET_ASCII_COMPATIBLE_P (charset))
 +      CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
  
 -  val = Vcoding_category_list;
 +      charset_list = XCDR (charset_list);
 +      charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
 +      if (CHARSET_DIMENSION (charset) != 2)
 +      error ("Dimension of charset %s is not two",
 +             SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
  
 -  while (CONSP (val) && i < CODING_CATEGORY_IDX_MAX)
 +      category = coding_category_big5;
 +      Vbig5_coding_system = name;
 +    }
 +  else if (EQ (coding_type, Qraw_text))
      {
 -      if (! SYMBOLP (XCAR (val)))
 -      break;
 -      idx = XFASTINT (Fget (XCAR (val), Qcoding_category_index));
 -      if (idx >= CODING_CATEGORY_IDX_MAX)
 -      break;
 -      coding_priorities[i++] = (1 << idx);
 -      val = XCDR (val);
 +      category = coding_category_raw_text;
 +      CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
 +    }
 +  else if (EQ (coding_type, Qutf_8))
 +    {
 +      category = coding_category_utf_8;
 +      CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
 +    }
 +  else if (EQ (coding_type, Qundecided))
 +    category = coding_category_undecided;
 +  else
 +    error ("Invalid coding system type: %s",
 +         SDATA (SYMBOL_NAME (coding_type)));
 +
 +  CODING_ATTR_CATEGORY (attrs) = make_number (category);
 +  CODING_ATTR_PLIST (attrs)
 +    = Fcons (QCcategory, Fcons (AREF (Vcoding_category_table, category),
 +                              CODING_ATTR_PLIST (attrs)));
 +  CODING_ATTR_PLIST (attrs)
 +    = Fcons (QCascii_compatible_p, 
 +           Fcons (CODING_ATTR_ASCII_COMPAT (attrs),
 +                  CODING_ATTR_PLIST (attrs)));
 +
 +  eol_type = args[coding_arg_eol_type];
 +  if (! NILP (eol_type)
 +      && ! EQ (eol_type, Qunix)
 +      && ! EQ (eol_type, Qdos)
 +      && ! EQ (eol_type, Qmac))
 +    error ("Invalid eol-type");
 +
 +  aliases = Fcons (name, Qnil);
 +
 +  if (NILP (eol_type))
 +    {
 +      eol_type = make_subsidiaries (name);
 +      for (i = 0; i < 3; i++)
 +      {
 +        Lisp_Object this_spec, this_name, this_aliases, this_eol_type;
 +
 +        this_name = AREF (eol_type, i);
 +        this_aliases = Fcons (this_name, Qnil);
 +        this_eol_type = (i == 0 ? Qunix : i == 1 ? Qdos : Qmac);
 +        this_spec = Fmake_vector (make_number (3), attrs);
 +        ASET (this_spec, 1, this_aliases);
 +        ASET (this_spec, 2, this_eol_type);
 +        Fputhash (this_name, this_spec, Vcoding_system_hash_table);
 +        Vcoding_system_list = Fcons (this_name, Vcoding_system_list);
 +        val = Fassoc (Fsymbol_name (this_name), Vcoding_system_alist);
 +        if (NILP (val))
 +          Vcoding_system_alist
 +            = Fcons (Fcons (Fsymbol_name (this_name), Qnil),
 +                     Vcoding_system_alist);
 +      }
      }
 -  /* If coding-category-list is valid and contains all coding
 -     categories, `i' should be CODING_CATEGORY_IDX_MAX now.  If not,
 -     the following code saves Emacs from crashing.  */
 -  while (i < CODING_CATEGORY_IDX_MAX)
 -    coding_priorities[i++] = CODING_CATEGORY_MASK_RAW_TEXT;
 +
 +  spec_vec = Fmake_vector (make_number (3), attrs);
 +  ASET (spec_vec, 1, aliases);
 +  ASET (spec_vec, 2, eol_type);
 +
 +  Fputhash (name, spec_vec, Vcoding_system_hash_table);
 +  Vcoding_system_list = Fcons (name, Vcoding_system_list);
 +  val = Fassoc (Fsymbol_name (name), Vcoding_system_alist);
 +  if (NILP (val))
 +    Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil),
 +                                Vcoding_system_alist);
 +
 +  {
 +    int id = coding_categories[category].id;
 +
 +    if (id < 0 || EQ (name, CODING_ID_NAME (id)))
 +      setup_coding_system (name, &coding_categories[category]);
 +  }
  
    return Qnil;
 +
 + short_args:
 +  return Fsignal (Qwrong_number_of_arguments,
 +                Fcons (intern ("define-coding-system-internal"),
 +                       make_number (nargs)));
  }
  
 -DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal,
 -       Sdefine_coding_system_internal, 1, 1, 0,
 -       doc: /* Register CODING-SYSTEM as a base coding system.
 -This function is internal use only.  */)
 -     (coding_system)
 -     Lisp_Object coding_system;
 +
 +DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
 +       3, 3, 0,
 +       doc: /* Change value in CODING-SYSTEM's property list PROP to VAL.  */)
 +  (coding_system, prop, val)
 +     Lisp_Object coding_system, prop, val;
  {
 -  Lisp_Object safe_chars, slot;
 +  Lisp_Object spec, attrs;
  
 -  if (NILP (Fcheck_coding_system (coding_system)))
 -    Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
 -  safe_chars = coding_safe_chars (coding_system);
 -  if (! EQ (safe_chars, Qt) && ! CHAR_TABLE_P (safe_chars))
 -    error ("No valid safe-chars property for %s",
 -         SDATA (SYMBOL_NAME (coding_system)));
 -  if (EQ (safe_chars, Qt))
 +  CHECK_CODING_SYSTEM_GET_SPEC (coding_system, spec);
 +  attrs = AREF (spec, 0);
 +  if (EQ (prop, QCmnemonic))
      {
 -      if (NILP (Fmemq (coding_system, XCAR (Vcoding_system_safe_chars))))
 -      XSETCAR (Vcoding_system_safe_chars,
 -               Fcons (coding_system, XCAR (Vcoding_system_safe_chars)));
 +      if (! STRINGP (val))
 +      CHECK_CHARACTER (val);
 +      CODING_ATTR_MNEMONIC (attrs) = val;
      }
 -  else
 +  else if (EQ (prop, QCdefalut_char))
      {
 -      slot = Fassq (coding_system, XCDR (Vcoding_system_safe_chars));
 -      if (NILP (slot))
 -      XSETCDR (Vcoding_system_safe_chars,
 -               nconc2 (XCDR (Vcoding_system_safe_chars),
 -                       Fcons (Fcons (coding_system, safe_chars), Qnil)));
 +      if (NILP (val))
 +      val = make_number (' ');
        else
 -      XSETCDR (slot, safe_chars);
 +      CHECK_CHARACTER (val);
 +      CODING_ATTR_DEFAULT_CHAR (attrs) = val;
 +    }
 +  else if (EQ (prop, QCdecode_translation_table))
 +    {
 +      if (! CHAR_TABLE_P (val) && ! CONSP (val))
 +      CHECK_SYMBOL (val);
 +      CODING_ATTR_DECODE_TBL (attrs) = val;
 +    }
 +  else if (EQ (prop, QCencode_translation_table))
 +    {
 +      if (! CHAR_TABLE_P (val) && ! CONSP (val))
 +      CHECK_SYMBOL (val);
 +      CODING_ATTR_ENCODE_TBL (attrs) = val;
 +    }
 +  else if (EQ (prop, QCpost_read_conversion))
 +    {
 +      CHECK_SYMBOL (val);
 +      CODING_ATTR_POST_READ (attrs) = val;
 +    }
 +  else if (EQ (prop, QCpre_write_conversion))
 +    {
 +      CHECK_SYMBOL (val);
 +      CODING_ATTR_PRE_WRITE (attrs) = val;
 +    }
 +  else if (EQ (prop, QCascii_compatible_p))
 +    {
 +      CODING_ATTR_ASCII_COMPAT (attrs) = val;
 +    }
 +
 +  CODING_ATTR_PLIST (attrs)
 +    = Fplist_put (CODING_ATTR_PLIST (attrs), prop, val);
 +  return val;
 +}
 +
 +
 +DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias,
 +       Sdefine_coding_system_alias, 2, 2, 0,
 +       doc: /* Define ALIAS as an alias for CODING-SYSTEM.  */)
 +     (alias, coding_system)
 +     Lisp_Object alias, coding_system;
 +{
 +  Lisp_Object spec, aliases, eol_type, val;
 +
 +  CHECK_SYMBOL (alias);
 +  CHECK_CODING_SYSTEM_GET_SPEC (coding_system, spec);
 +  aliases = AREF (spec, 1);
 +  /* ALISES should be a list of length more than zero, and the first
 +     element is a base coding system.  Append ALIAS at the tail of the
 +     list.  */
 +  while (!NILP (XCDR (aliases)))
 +    aliases = XCDR (aliases);
 +  XSETCDR (aliases, Fcons (alias, Qnil));
 +
 +  eol_type = AREF (spec, 2);
 +  if (VECTORP (eol_type))
 +    {
 +      Lisp_Object subsidiaries;
 +      int i;
 +
 +      subsidiaries = make_subsidiaries (alias);
 +      for (i = 0; i < 3; i++)
 +      Fdefine_coding_system_alias (AREF (subsidiaries, i),
 +                                   AREF (eol_type, i));
      }
 +
 +  Fputhash (alias, spec, Vcoding_system_hash_table);
 +  Vcoding_system_list = Fcons (alias, Vcoding_system_list);
 +  val = Fassoc (Fsymbol_name (alias), Vcoding_system_alist);
 +  if (NILP (val))
 +    Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (alias), Qnil),
 +                                Vcoding_system_alist);
 +
    return Qnil;
  }
  
diff --cc src/config.in
Simple merge
Simple merge
diff --cc src/dispnew.c
Simple merge
diff --cc src/emacs.c
Simple merge
diff --cc src/fileio.c
Simple merge
diff --cc src/fns.c
Simple merge
diff --cc src/frame.c
Simple merge
diff --cc src/intervals.c
Simple merge
diff --cc src/lisp.h
Simple merge
diff --cc src/lread.c
index b6161ebedaa5b6eff05bfcbb451c8a850756c6ac,31f974d9bc03bd41f6aaaf6ac1b7cdc2f5beb73a..d8abde1c4588350acbc1200333c49fdff334b721
@@@ -89,13 -87,8 +89,14 @@@ Lisp_Object Qascii_character, Qload, Ql
  Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
  Lisp_Object Qinhibit_file_name_operation;
  Lisp_Object Qeval_buffer_list, Veval_buffer_list;
+ Lisp_Object Qfile_truename, Qdo_after_load_evaluation; /* ACM 2006/5/16 */
  
 +/* Used instead of Qget_file_char while loading *.elc files compiled
 +   by Emacs 21 or older.  */
 +static Lisp_Object Qget_emacs_mule_file_char;
 +
 +static Lisp_Object Qload_force_doc_strings;
 +
  extern Lisp_Object Qevent_symbol_element_mask;
  extern Lisp_Object Qfile_exists_p;
  
@@@ -906,8 -728,7 +907,9 @@@ Return t if the file exists and loads s
    Lisp_Object handler;
    int safe_p = 1;
    char *fmode = "r";
+   Lisp_Object tmp[2];
 +  int version;
 +
  #ifdef DOS_NT
    fmode = "rt";
  #endif /* DOS_NT */
      Vloads_in_progress = Fcons (found, Vloads_in_progress);
    }
  
+   /* Get the name for load-history. */
+   hist_file_name = (! NILP (Vpurify_flag)
+                     ? Fconcat (2, (tmp[0] = Ffile_name_directory (file),
+                                    tmp[1] = Ffile_name_nondirectory (found),
+                                    tmp))
+                     : found) ;
 +  version = -1;
    if (!bcmp (SDATA (found) + SBYTES (found) - 4,
 -           ".elc", 4))
 +           ".elc", 4)
 +      || (version = safe_to_load_p (fd)) > 0)
      /* Load .elc files directly, but not when they are
         remote and have no handler!  */
      {
          struct stat s1, s2;
          int result;
  
-         GCPRO2 (file, found);
+         GCPRO3 (file, found, hist_file_name);
  
 -        if (!safe_to_load_p (fd))
 +        if (version < 0
 +            && ! (version = safe_to_load_p (fd)))
            {
              safe_p = 0;
              if (!load_dangerous_libraries)
    load_descriptor_list
      = Fcons (make_number (fileno (stream)), load_descriptor_list);
    load_in_progress++;
 -  readevalloop (Qget_file_char, stream, hist_file_name,
 -              Feval, 0, Qnil, Qnil, Qnil, Qnil);
 +  if (! version || version >= 22)
-     readevalloop (Qget_file_char, stream,
-                 (! NILP (Vpurify_flag) ? file : found),
++    readevalloop (Qget_file_char, stream, hist_file_name,
 +                Feval, 0, Qnil, Qnil, Qnil, Qnil);
 +  else
 +    {
 +      /* We can't handle a file which was compiled with
 +       byte-compile-dynamic by older version of Emacs.  */
 +      specbind (Qload_force_doc_strings, Qt);
-       readevalloop (Qget_emacs_mule_file_char, stream, file, Feval,
++      readevalloop (Qget_emacs_mule_file_char, stream, hist_file_name, Feval,
 +                  0, Qnil, Qnil, Qnil, Qnil);
 +    }
    unbind_to (count, Qnil);
  
-   /* Run any load-hooks for this file.  */
-   temp = Fassoc (file, Vafter_load_alist);
-   if (!NILP (temp))
-     Fprogn (Fcdr (temp));
+   /* Run any eval-after-load forms for this file */
+   if (NILP (Vpurify_flag)
+       && (!NILP (Ffboundp (Qdo_after_load_evaluation))))
+     call1 (Qdo_after_load_evaluation, hist_file_name) ;
    UNGCPRO;
  
    if (saved_doc_string)
@@@ -1581,8 -1396,16 +1589,14 @@@ readevalloop (readcharfun, stream, sour
    record_unwind_protect (readevalloop_1, load_convert_to_unibyte ? Qt : Qnil);
    load_convert_to_unibyte = !NILP (unibyte);
  
 -  readchar_backlog = -1;
 -
    GCPRO4 (sourcename, readfun, start, end);
  
+   /* Try to ensure sourcename is a truename, except whilst preloading. */
+   if (NILP (Vpurify_flag)
+       && !NILP (sourcename) && Ffile_name_absolute_p (sourcename)
+       && (!NILP (Ffboundp (Qfile_truename))))
+     sourcename = call1 (Qfile_truename, sourcename) ;
    LOADHIST_ATTACH (sourcename);
  
    continue_reading_p = 1;
diff --cc src/macfns.c
Simple merge
diff --cc src/macgui.h
Simple merge
diff --cc src/macterm.c
Simple merge
diff --cc src/minibuf.c
Simple merge
diff --cc src/process.c
Simple merge
diff --cc src/search.c
Simple merge
diff --cc src/w32fns.c
Simple merge
diff --cc src/w32term.c
Simple merge
diff --cc src/window.c
Simple merge
diff --cc src/xdisp.c
Simple merge
diff --cc src/xfaces.c
index 2b2f1620133822156c7c1b3c6c7c168457e90e07,df303e401fd75b4d8049b665aac45087dc8fbbc3..9adc9218f6d7e44b1e3d33e97115ab7b127fb06b
@@@ -7485,10 -7070,10 +7484,10 @@@ realize_default_face (f
    xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
    check_lface (lface);
    bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs);
 -  face = realize_face (c, attrs, 0, NULL, DEFAULT_FACE_ID);
 +  face = realize_face (c, attrs, DEFAULT_FACE_ID);
  
  #ifdef HAVE_WINDOW_SYSTEM
- #ifdef HAVE_X_WINDOWS  
+ #ifdef HAVE_X_WINDOWS
    if (face->font != FRAME_FONT (f))
      /* As the font specified for the frame was not acceptable as a
         font for the default face (perhaps because auto-scaled fonts
diff --cc src/xfns.c
Simple merge
diff --cc src/xmenu.c
Simple merge
diff --cc src/xterm.c
Simple merge
diff --cc src/xterm.h
Simple merge