changeset 450:98528da0b7fc r21-2-40

Import from CVS: tag r21-2-40
author cvs
date Mon, 13 Aug 2007 11:39:20 +0200
parents c83749d23eb5
children 8ad70c5cd5d7
files CHANGES-beta ChangeLog PROBLEMS configure configure.in lib-src/ChangeLog lisp/ChangeLog lisp/ChangeLog.1 lisp/dump-paths.el lisp/mule/hebrew.el lisp/mule/japanese.el lisp/mule/mule-category.el lisp/mule/mule-ccl.el lisp/paragraphs.el lwlib/ChangeLog lwlib/lwlib-Xaw.c lwlib/lwlib-Xaw.h lwlib/lwlib-Xlw.c lwlib/lwlib-Xlw.h lwlib/lwlib-Xm.c lwlib/lwlib-Xm.h lwlib/lwlib.c lwlib/lwlib.h man/ChangeLog man/emodules.texi man/texinfo.texi netinstall/ChangeLog nt/ChangeLog src/ChangeLog src/alloc.c src/elhash.c src/elhash.h src/event-Xt.c src/frame-x.c src/frame.c src/glyphs-x.c src/glyphs.c src/glyphs.h src/menubar.c src/mule-ccl.c src/redisplay-x.c src/redisplay.h src/regex.c src/window.c tests/ChangeLog version.sh
diffstat 46 files changed, 538 insertions(+), 173 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES-beta	Mon Aug 13 11:38:26 2007 +0200
+++ b/CHANGES-beta	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,12 @@
+to 21.2.40 "Persephone"
+-- various doc fixes -- Stephen Turnbull
+-- more widget bug fixes -- Andy Piper
+-- Introduce yet another hash table weakness type -- Andy Piper
+-- SCO 5 fixes -- Golubev I. N.
+-- SunOS 4 works again -- MIYASHITA Hisashi
+-- Make peace with Mandrake's Alt-Meta hacks -- Stephen Turnbull
+-- Remove input-method-xfs.o -- Kazuyuki IENAGA
+
 to 21.2.39 "Millennium"
 -- Safer coding-priority-list -- Stephen Turnbull
 -- Andreas Jaeger resigns as core maintainer :-(
--- a/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,23 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
+2000-12-26  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* PROBLEMS (Running/Linux):  Rehabilitate Mandrake; tip for color-gcc.
+
+2000-12-20  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* PROBLEMS (Linux): document Mandrake policy, how to get Meta on
+	Alt, and getaddrinfo() blocking trying to get localhost's CNAME.
+
+2000-07-20  Kazuyuki IENAGA <ienaga@xemacs.org>
+
+	* configure.in: use input-method-xlib.o for USE_XFONTSET instead
+	of input-method-xfs.o.
+
+	* configure: ditto
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
--- a/PROBLEMS	Mon Aug 13 11:38:26 2007 +0200
+++ b/PROBLEMS	Mon Aug 13 11:39:20 2007 +0200
@@ -1258,19 +1258,23 @@
 
 
 ** Linux
-*** Mandrake (all versions)
+*** Mandrake
 
-Cannot be fully supported by XEmacs developers because they insist on
-applying known broken patches.
+The Mandrake Linux distribution is attempting to comprehensively
+update the user interface, and make it consistent across
+applications.  This is very difficult, and will occasionally cause
+conflicts with applications like Emacs with their own long-established
+interfaces.  Known issues specific to Mandrake or especially common:
 
-One known issue is that on keyboards with both a Meta key (typically
-the Windows key on PCs) and an Alt key, XEmacs wants to bind the Meta
-modifier to the Meta key.  Mandrake has a policy that XEmacs
-Meta-chords should use the Alt key, which they enforce by patching
-XEmacs's modifier-handling code, making the Meta and Alt modifiers
-synonymous.  This will break planned upgrades to XEmacs to allow menu
-hotkeys; be warned.  See next topic for how to implement Meta-on-Alt
-portably.
+Some versions of XEmacs (21.1.9 is known) distributed with Mandrake
+were patched to make the Meta and Alt keysyms synonymous.  These
+normally work as expected in the Mandrake environment.  However,
+custom-built XEmacsen (including all 21.2 betas) will "inexplicably"
+not respect the "Alt-invokes-Meta-commands" convention.  See "I want
+XEmacs to use the Alt key" below.
+
+The color-gcc wrapper (see below) is in common use on the Mandrake
+platform.
 
 *** I want XEmacs to use the Alt key, not the XXX key, for Meta commands
 
@@ -1284,12 +1288,35 @@
 One correct way to implement this was suggested on comp.emacs.xemacs
 (by Kilian Foth and in more detail by Michael Piotrowski): unmap the
 Meta modifier using xmodmap or xkb, and then map the Meta/Windows key
-to the Super or Hyper modifier.  XEmacs will not find the Meta keysym,
-and default to using the Alt key for Meta keybindings.  Typically few
-applications use the (X11) Meta modifier (sawfish is one); it is
-tedious but not too much so to teach them to use Super instead of
-Meta.  There may be further useful hints in the discussion of
-keymapping on non-Linux platforms.
+to the Super or Hyper keysym and an appropriate mod bit.  XEmacs will
+not find the Meta keysym, and default to using the Alt key for Meta
+keybindings.  Typically few applications use the (X11) Meta modifier;
+it is tedious but not too much so to teach the ones you need to use
+Super instead of Meta.  There may be further useful hints in the
+discussion of keymapping on non-Linux platforms.
+
+*** The color-gcc wrapper
+
+This wrapper colorizes the error messages from gcc.  By default XEmacs
+does not interpret the escape sequences used to generate colors,
+resulting in a cluttered, hard-to-read buffer.  You can remove the
+wrapper, or defeat the wrapper colorization in Emacs process buffers
+by editing the "nocolor" attribute in /etc/colorgccrc:
+
+$ diff -u /etc/colorgccrc.old /etc/colorgccrc
+--- /etc/colorgccrc.old Tue Dec 26 02:17:46 2000
++++ /etc/colorgccrc     Tue Dec 26 02:15:48 2000
+@@ -34,1 +34,1 @@
+-nocolor: dumb
++nocolor: dumb emacs
+
+If you want colorization in your Emacs buffers, you may get good
+results from the ansi-color.el library:
+
+http://www.geocities.com/kensanata/color-emacs.html#ansicolors
+
+This is written for the mainline GNU Emacs but the author has made
+efforts to adapt it to XEmacs.  YMMV.
 
 *** You get crashes in a non-C locale with Linux GNU Libc 2.0.
 
--- a/configure	Mon Aug 13 11:38:26 2007 +0200
+++ b/configure	Mon Aug 13 11:39:20 2007 +0200
@@ -9476,8 +9476,8 @@
 }
 
       if test "$with_xim" = "no" ; then
-        extra_objs="$extra_objs input-method-xfs.o" &&  if test "$extra_verbose" = "yes"; then
-   echo "    xemacs will be linked with \"input-method-xfs.o\""
+        extra_objs="$extra_objs input-method-xlib.o" &&  if test "$extra_verbose" = "yes"; then
+   echo "    xemacs will be linked with \"input-method-xlib.o\""
  fi
       fi
     fi
--- a/configure.in	Mon Aug 13 11:38:26 2007 +0200
+++ b/configure.in	Mon Aug 13 11:39:20 2007 +0200
@@ -3487,7 +3487,7 @@
     if test "$with_xfs" = "yes" && test "$with_menubars" = "lucid"; then
       AC_DEFINE(USE_XFONTSET)
       if test "$with_xim" = "no" ; then
-        XE_ADD_OBJS(input-method-xfs.o)
+        XE_ADD_OBJS(input-method-xlib.o)
       fi
     fi
   fi dnl with_xfs
--- a/lib-src/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/lib-src/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,7 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
--- a/lisp/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/lisp/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,23 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
+2001-01-06  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* mule/hebrew.el: Fix comments and typos.
+	mule/japanese.el: Fix comments, typos, and 8-bit character encoding.
+
+2001-01-06  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* ChangeLog.1: move ancient log from fill.el.
+
+	* dump-paths.el:
+	paragraphs.el:
+	mule/mule-category.el:
+	Miscellaneous typo fixes and slight doc clarifications.
+
+	* mule/mule-ccl.el:  Correct file name in header.
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
--- a/lisp/ChangeLog.1	Mon Aug 13 11:38:26 2007 +0200
+++ b/lisp/ChangeLog.1	Mon Aug 13 11:39:20 2007 +0200
@@ -6580,6 +6580,11 @@
 	Abrahamsen).
 	(batch-update-autoloads): Use it.
 
+Fri Mar 14 20:00:00 1997  Jareth Hein  <jhod@po.iijnet.or.jp>
+
+	* prim/fill.el:  added functions for kinsoku (Asian text line
+	break processing).
+
 Fri Mar 14 19:59:36 1997  Bob Weiner  <weiner@infodock.com>
 
 	* packages/jka-compr.el (jka-compr-installed-p): Simplify.
--- a/lisp/dump-paths.el	Mon Aug 13 11:38:26 2007 +0200
+++ b/lisp/dump-paths.el	Mon Aug 13 11:39:20 2007 +0200
@@ -28,6 +28,7 @@
 
 ;; This sets up the various paths for continuing loading files for
 ;; dumping.
+;; #### This code is duplicated in startup.el (startup-setup-paths).
 
 (let ((debug-paths (or debug-paths
 		      (and (getenv "EMACSDEBUGPATHS")
--- a/lisp/mule/hebrew.el	Mon Aug 13 11:38:26 2007 +0200
+++ b/lisp/mule/hebrew.el	Mon Aug 13 11:39:20 2007 +0200
@@ -24,7 +24,7 @@
 
 ;;; Commentary:
 
-;; For Hebrew, the character sets ISO8859-8 is supported.
+;;  ISO 8859-8 (Hebrew) support.
 
 ;;; Code:
 
@@ -34,19 +34,9 @@
 (modify-syntax-entry (make-char 'hebrew-iso8859-8 32) "w") ; no-break space
 
 
-;; (make-coding-system
-;;  'hebrew-iso-8bit 2 ?8
-;;  "ISO 2022 based 8-bit encoding for Hebrew (MIME:ISO-8859-8)"
-;;  '(ascii hebrew-iso8859-8 nil nil
-;;    nil ascii-eol ascii-cntl nil nil nil nil nil t)
-;;  '((safe-charsets ascii hebrew-iso8859-8)
-;;    (mime-charset . iso-8859-8)))
-
-;; (define-coding-system-alias 'iso-8859-8 'hebrew-iso-8bit)
-
 (make-coding-system
  'iso-8859-8 'iso2022
- "MIME ISO-8859-8"
+ "ISO-8859-8 (ISO 2022 based 8-bit encoding for Hebrew)"
  '(charset-g0 ascii
    charset-g1 hebrew-iso8859-8
    charset-g2 t
@@ -57,7 +47,7 @@
 
 (make-coding-system
  'ctext-hebrew 'iso2022
- "Coding-system of Hebrew."
+ "Coding-system for Hebrew."
  '(charset-g0 ascii
    charset-g1 hebrew-iso8859-8
    charset-g2 t
@@ -67,7 +57,7 @@
 
 (defun setup-hebrew-environment ()
   "Setup multilingual environment (MULE) for Hebrew.
-But, please note that right-to-left writing is not yet supported."
+Note: right-to-left writing is not yet supported."
   (interactive)
   (set-language-environment "Hebrew"))
 
--- a/lisp/mule/japanese.el	Mon Aug 13 11:38:26 2007 +0200
+++ b/lisp/mule/japanese.el	Mon Aug 13 11:39:20 2007 +0200
@@ -125,8 +125,11 @@
     ;; (setq egg-default-startup-file "eggrc-wnn")
     (setq-default its:*current-map* (its:get-mode-map "roma-kana"))))
 
-;; stuff for providing gramatic processing of Japanese text
+;; stuff for providing grammatic processing of Japanese text
 ;; something like this should probably be created for all environments...
+;; #### Arrgh.  This stuff should defvar'd in either fill.el or kinsoku.el.
+;; Then the language environment should set these things, probably buffer-
+;; locally.
 
 (defvar aletter (concat "\\(" ascii-char "\\|" kanji-char "\\)"))
 (defvar kanji-space-insertable (concat 
@@ -137,6 +140,7 @@
 	   ascii-alphanumeric  kanji-kanji-char "\\|"
 	   kanji-kanji-char    ascii-alphanumeric ))
 
+;; #### will be moved to fill.el
 (defvar space-insertable (concat " " aletter "\\|" kanji-space-insertable)
   "Regexp for finding points that can have spaces inserted into them for justification")
 
@@ -258,7 +262,7 @@
 			       shift_jis iso-2022-jp-2)
 ;;	      (input-method . "japanese")
 	      (features japan-util)
-	      (sample-text . "Japanese ($BF|K\8l(B)	$B$3$s$K$A$O(B, )IºÝÆÁÊ")-A
+	      (sample-text . "Japanese ($BF|K\8l(B)	$B$3$s$K$A$O(B, (I:]FAJ(B")
 	      (documentation . t)))
 
 ;;; japanese.el ends here
--- a/lisp/mule/mule-category.el	Mon Aug 13 11:38:26 2007 +0200
+++ b/lisp/mule/mule-category.el	Mon Aug 13 11:39:20 2007 +0200
@@ -279,6 +279,11 @@
 
 ;;; At the present, I know Japanese and Chinese text can
 ;;; break line at any point under a restriction of 'kinsoku'.
+;;; #### SJT this needs to be set by language environments and probably should
+;;; be buffer-local---strategy for dealing with this: check all $language.el
+;;; files and also mule-base/$language-utils.el files for variables set;
+;;; these should be made buffer local and some kind of a- or p-list of vars
+;;; to be set for a language environment created. 
 (defvar word-across-newline "\\(\\cj\\|\\cc\\|\\ct\\)"
   "Regular expression of such characters which can be a word across newline.")
 
--- a/lisp/mule/mule-ccl.el	Mon Aug 13 11:38:26 2007 +0200
+++ b/lisp/mule/mule-ccl.el	Mon Aug 13 11:39:20 2007 +0200
@@ -1,4 +1,4 @@
-;;; ccl.el --- CCL (Code Conversion Language) compiler
+;;; mule-ccl.el --- CCL (Code Conversion Language) compiler
 
 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
 ;; Licensed to the Free Software Foundation.
--- a/lisp/paragraphs.el	Mon Aug 13 11:38:26 2007 +0200
+++ b/lisp/paragraphs.el	Mon Aug 13 11:39:20 2007 +0200
@@ -124,7 +124,9 @@
 
 (defconst paragraph-separate "[ \t\f]*$" "\
 *Regexp for beginning of a line that separates paragraphs.
-If you change this, you may have to change paragraph-start also.
+If you change this, you may have to change `paragraph-start' also.
+
+A line matching this is not part of any paragraph.
 
 This is matched against the text at the left margin, which is not necessarily
 the beginning of the line, so it should not use \"^\" as an anchor.  This
@@ -347,7 +349,7 @@
 With negative argument, move backward repeatedly to `sentence-beginning'.
 
 The variable `sentence-end' is a regular expression that matches ends of
-sentences.  Also, every paragraph boundary terminates sentences as well."
+sentences.  A paragraph boundary also terminates a sentence."
   (interactive "_p") ; XEmacs
   (or arg (setq arg 1))
   (while (< arg 0)
--- a/lwlib/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,28 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
+2001-01-06  Martin Buchholz  <martin@xemacs.org>
+
+	* lwlib-Xaw.c (xaw_creation_table): Make const.
+	* lwlib-Xaw.h (xaw_creation_table): Make const.
+	* lwlib-Xlw.c (xlw_creation_table): Make const.
+	* lwlib-Xlw.h (xlw_creation_table): Make const.
+	* lwlib-Xm.c (xm_creation_table): Make const.
+	* lwlib-Xm.h (xm_creation_table): Make const.
+	* lwlib.c (find_in_table): Use const.
+
+2001-01-02  Andy Piper  <andy@xemacs.org>
+
+	* lwlib.h (_widget_args): add args_changed. Necessary because we
+	reference count args.
+
+	* lwlib.c (lw_add_widget_value_arg): set args_changed flag.
+	(merge_widget_value_args): mark as changed if args_changed is
+	true.
+	(update_all_widget_values): reset args_changed.
+	(initialize_widget_instance): ditto.
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
--- a/lwlib/lwlib-Xaw.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/lwlib-Xaw.c	Mon Aug 13 11:39:20 2007 +0200
@@ -880,7 +880,7 @@
 
 #endif /* LWLIB_WIDGETS_ATHENA */
 
-widget_creation_entry
+const widget_creation_entry
 xaw_creation_table [] =
 {
 #ifdef LWLIB_SCROLLBARS_ATHENA
--- a/lwlib/lwlib-Xaw.h	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/lwlib-Xaw.h	Mon Aug 13 11:39:20 2007 +0200
@@ -3,7 +3,7 @@
 
 #include "lwlib-internal.h"
 
-extern widget_creation_entry xaw_creation_table [];
+extern const widget_creation_entry xaw_creation_table [];
 
 Widget 
 xaw_create_dialog (widget_instance* instance);
--- a/lwlib/lwlib-Xlw.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/lwlib-Xlw.c	Mon Aug 13 11:39:20 2007 +0200
@@ -482,7 +482,7 @@
 }
 #endif
 
-widget_creation_entry 
+const widget_creation_entry 
 xlw_creation_table [] =
 {
 #ifdef LWLIB_MENUBARS_LUCID
--- a/lwlib/lwlib-Xlw.h	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/lwlib-Xlw.h	Mon Aug 13 11:39:20 2007 +0200
@@ -3,7 +3,7 @@
 
 #include "lwlib-internal.h"
 
-extern widget_creation_entry xlw_creation_table [];
+extern const widget_creation_entry xlw_creation_table [];
 extern widget_creation_function xlw_create_dialog;
 
 Boolean
--- a/lwlib/lwlib-Xm.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/lwlib-Xm.c	Mon Aug 13 11:39:20 2007 +0200
@@ -1786,7 +1786,7 @@
 
 /* Table of functions to create widgets */
 
-widget_creation_entry
+const widget_creation_entry
 xm_creation_table [] =
 {
 #ifdef LWLIB_MENUBARS_MOTIF
--- a/lwlib/lwlib-Xm.h	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/lwlib-Xm.h	Mon Aug 13 11:39:20 2007 +0200
@@ -3,7 +3,7 @@
 
 #include "lwlib-internal.h"
 
-extern widget_creation_entry xm_creation_table [];
+extern const widget_creation_entry xm_creation_table [];
 
 Widget 
 xm_create_dialog (widget_instance* instance);
--- a/lwlib/lwlib.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/lwlib.c	Mon Aug 13 11:39:20 2007 +0200
@@ -264,6 +264,10 @@
       lw_copy_widget_value_args (new, old);
       changed = True;
     }
+  else if (new->args && new->args == old->args && new->args->args_changed == True)
+    {
+      changed = True;
+    }
 
   return changed;
 }
@@ -756,7 +760,11 @@
     update_one_widget_instance (instance, deep_p);
 
   for (val = info->val; val; val = val->next)
-    val->change = NO_CHANGE;
+    {
+      val->change = NO_CHANGE;
+      if (val->args)
+	val->args->args_changed = False;
+    }
 }
 
 void
@@ -821,7 +829,11 @@
   update_one_widget_instance (instance, True);
 
   for (val = instance->info->val; val; val = val->next)
-    val->change = NO_CHANGE;
+    {
+      val->change = NO_CHANGE;
+      if (val->args)
+	val->args->args_changed = False;
+    }
 }
 
 /* strcasecmp() is not sufficiently portable or standard,
@@ -841,9 +853,9 @@
 }
 
 static widget_creation_function
-find_in_table (const char *type, widget_creation_entry *table)
+find_in_table (const char *type, const widget_creation_entry table[])
 {
-  widget_creation_entry *cur;
+  const widget_creation_entry *cur;
   for (cur = table; cur->type; cur++)
     if (!ascii_strcasecmp (type, cur->type))
       return cur->function;
@@ -1393,6 +1405,8 @@
   if (wv->args->nargs > 10)
     return;
 
+  /* Register the change. */
+  wv->args->args_changed = True;
   /* If the arg is already there then we must replace it. */
   for (i = 0; i < wv->args->nargs; i++)
     {
--- a/lwlib/lwlib.h	Mon Aug 13 11:38:26 2007 +0200
+++ b/lwlib/lwlib.h	Mon Aug 13 11:39:20 2007 +0200
@@ -106,6 +106,9 @@
   /* Copying args is impossible so we make the caller give us heap allocated
      args and free them when no one wants them any more. */
   int	ref_count;
+  /* Since we are reference counting we need to be able to determine
+     when something has changed. */
+  Boolean	args_changed;
 } widget_args;
 
 typedef struct _widget_value
--- a/man/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/man/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,14 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
+2001-01-06  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* emodules.texi (Required Functions): Xref coding rules for dual-use
+	modules (module and statically linked).  Typo fix.
+
+	* texinfo.texi (ref):  Typo fix.
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
--- a/man/emodules.texi	Mon Aug 13 11:38:26 2007 +0200
+++ b/man/emodules.texi	Mon Aug 13 11:39:20 2007 +0200
@@ -350,7 +350,14 @@
 @code{DEFVAR_LISP()}, @code{DEFVAR_BOOL()} etc, and its purpose is to
 declare and initialize all and any variables that your module defines.
 They syntax for declaring variables is identical to the syntax used for
-all internal @value{emacs} source code.
+all internal @value{emacs} source code.  If the module is intended to be
+usable statically linked into XEmacs, the actions of this function are
+severely restricted.  @xref{General Coding Rules,,,internals,
+@value{emacs} Internals Manual}.  Also see the comments in
+@file{src/emacs.c} (@code{main_1}).  Modules which perform
+initializations not permitted by these rules will probably work, but
+dual-use (dynamic loading and static linking) modules will require very
+careful, and possibly fragile, coding.
 
 @item modules_of_module
 @findex modules_of_module
@@ -665,7 +672,7 @@
 Once all of your source code files have been compiled (including the
 generated init file) you need to link them all together to create the
 loadable module.  To do this, you invoke @code{ellcc} in link mode, by
-passing the @code{--mode-link} option.  You need to specify the final
+passing the @code{--mode=link} option.  You need to specify the final
 output file using the @code{--mod-output=NAME} option, but other than
 that all other arguments are passed on directly to the system compiler
 or linker, along with any other required arguments to create the
--- a/man/texinfo.texi	Mon Aug 13 11:38:26 2007 +0200
+++ b/man/texinfo.texi	Mon Aug 13 11:39:20 2007 +0200
@@ -1,5 +1,5 @@
 \input texinfo.tex    @c -*-texinfo-*-
-@c $Id: texinfo.texi,v 1.8.2.5 2000/11/14 23:29:15 adrian Exp $
+@c $Id: texinfo.texi,v 1.8.2.6 2001/01/06 07:51:28 stephent Exp $
 @c %**start of header
 
 @c All text is ignored before the setfilename.
@@ -5882,7 +5882,7 @@
 produces
 
 @example
-For more information, see *Note Hurricanes.
+For more information, see *Note Hurricanes::.
 @end example
 
 @noindent
--- a/netinstall/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/netinstall/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,7 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
@@ -124,5 +128,5 @@
 
 	* all: port from cygwin setup.
 
-%%% $Id: ChangeLog,v 1.1.2.5 2000/12/31 12:03:34 martinb Exp $
-$Revision: 1.1.2.5 $
+%%% $Id: ChangeLog,v 1.1.2.6 2001/01/08 03:15:25 martinb Exp $
+$Revision: 1.1.2.6 $
--- a/nt/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/nt/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,7 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
--- a/src/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,98 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
+2001-01-06  Golubev I. N.  <gin@mo.msk.ru>
+
+	* regex.c: Replace PREFETCH with REGEX_PREFETCH.
+
+2001-01-06  Martin Buchholz  <martin@xemacs.org>
+
+	* alloc.c (dbg_valmask): Make const.
+	* alloc.c (dbg_typemask): Make const.
+	* alloc.c (dbg_USE_UNION_TYPE): Make const.
+	* alloc.c (dbg_valbits): Make const.
+	* alloc.c (dbg_gctypebits): Make const.
+
+2001-01-06  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* redisplay-x.c (x_bevel_area):
+	redisplay.h (struct rune):
+	Typo fixes in comments.
+
+2001-01-05  Andy Piper  <andy@xemacs.org>
+
+	* glyphs-x.c (x_redisplay_widget): use size changed for offset
+	adjustment.
+
+	* menubar.c (menubar_visible_p_changed): don't mark frame changed.
+
+2001-01-05  Martin Buchholz  <martin@xemacs.org>
+
+	* alloc.c (pure-bytes-used): Remove unused mendacious variable.
+
+	* mule-ccl.c (stack_idx_of_map_multiple):
+	Non const global data must not be initialized!
+	Found by MIYASHITA Hisashi.
+
+2001-01-02  Andy Piper  <andy@xemacs.org>
+
+	* frame.c (change_frame_size): make sure frame size is always
+	marked as changed.
+
+	* glyphs.c (image_instance_layout): minor code reuse.
+
+	* window.c (Fcurrent_window_configuration): revert previous
+	change.
+
+2001-01-02  Martin Buchholz  <martin@xemacs.org>
+
+	* glyphs.h:
+	* glyphs.c (make_image_instance_cache_hash_table): Use ANSI prototypes.
+
+2000-12-31  Andy Piper  <andy@xemacs.org>
+
+	* glyphs-x.c (x_unmap_subwindow): return focus to enclosing frame
+	when widget gets unmapped.
+
+	* event-Xt.c (emacs_Xt_handle_widget_losing_focus): new
+	function. Make sure widgets losing focus don't just drop it.
+	(handle_focus_event_1): record the widget with focus.
+
+2000-12-31  Andy Piper  <andy@xemacs.org>
+
+	* window.c (allocate_window): use
+	make_image_instance_cache_hash_table.
+	(make_dummy_parent): ditto.
+	(Fset_window_configuration): ditto.
+
+	* glyphs.h (INSTANTIATOR_TYPE): new macro.  declare new functions.
+
+	* glyphs.c (process_image_string_instantiator): use
+	INSTANTIATOR_TYPE.
+	(get_image_instantiator_governing_domain): ditto.
+	(normalize_image_instantiator): ditto.
+	(instantiate_image_instantiator): ditto.
+	(make_image_instance_1): ditto.
+	(image_instantiate): ditto. Key on glyph *and* instantiator type.
+	(instantiator_eq_equal): new function for use with instance hash
+	tables.
+	(instantiator_eq_hash): ditto.
+	(make_image_instance_cache_hash_table): create a suitable hash
+	table for storing image instances.
+
+	* elhash.h (hash_table_weakness): new internal weakness type
+	HASH_TABLE_KEY_CAR_VALUE_WEAK.
+	declare new functions.
+
+	* elhash.c (finish_marking_weak_hash_tables): introduce yet
+	another weakness type for glyphs.
+	(make_standard_lisp_hash_table): new function split out from
+	make_general_lisp_hash_table.
+	(make_lisp_hash_table): call make_standard_lisp_hash_table.
+	(hash_table_instantiate): ditto.
+	(Fmake_hash_table): ditto.
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
--- a/src/alloc.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/alloc.c	Mon Aug 13 11:39:20 2007 +0200
@@ -448,17 +448,17 @@
    about expressions in src/.gdbinit.  See src/.gdbinit or src/.dbxrc
    to see how this is used.  */
 
-EMACS_UINT dbg_valmask = ((1UL << VALBITS) - 1) << GCBITS;
-EMACS_UINT dbg_typemask = (1UL << GCTYPEBITS) - 1;
+const EMACS_UINT dbg_valmask = ((1UL << VALBITS) - 1) << GCBITS;
+const EMACS_UINT dbg_typemask = (1UL << GCTYPEBITS) - 1;
 
 #ifdef USE_UNION_TYPE
-unsigned char dbg_USE_UNION_TYPE = 1;
+const unsigned char dbg_USE_UNION_TYPE = 1;
 #else
-unsigned char dbg_USE_UNION_TYPE = 0;
+const unsigned char dbg_USE_UNION_TYPE = 0;
 #endif
 
-unsigned char dbg_valbits = VALBITS;
-unsigned char dbg_gctypebits = GCTYPEBITS;
+const unsigned char dbg_valbits = VALBITS;
+const unsigned char dbg_gctypebits = GCTYPEBITS;
 
 /* Macros turned into functions for ease of debugging.
    Debuggers don't know about macros! */
@@ -3944,8 +3944,6 @@
   staticidx = 0;
 }
 
-int pure_bytes_used = 0;
-
 void
 reinit_alloc (void)
 {
@@ -3997,10 +3995,6 @@
 See also `consing-since-gc'.
 */ );
 
-  DEFVAR_INT ("pure-bytes-used", &pure_bytes_used /*
-Number of bytes of sharable Lisp data allocated so far.
-*/ );
-
 #ifdef DEBUG_XEMACS
   DEFVAR_INT ("debug-allocation", &debug_allocation /*
 If non-zero, print out information to stderr about all objects allocated.
--- a/src/elhash.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/elhash.c	Mon Aug 13 11:39:20 2007 +0200
@@ -434,7 +434,44 @@
 }
 
 Lisp_Object
-make_general_lisp_hash_table (enum hash_table_test test,
+make_standard_lisp_hash_table (enum hash_table_test test,
+			       size_t size,
+			       double rehash_size,
+			       double rehash_threshold,
+			       enum hash_table_weakness weakness)
+{
+  hash_table_hash_function_t hash_function =  0;
+  hash_table_test_function_t test_function = 0;
+
+  switch (test)
+    {
+    case HASH_TABLE_EQ:
+      test_function = 0;
+      hash_function = 0;
+      break;
+
+    case HASH_TABLE_EQL:
+      test_function = lisp_object_eql_equal;
+      hash_function = lisp_object_eql_hash;
+      break;
+
+    case HASH_TABLE_EQUAL:
+      test_function = lisp_object_equal_equal;
+      hash_function = lisp_object_equal_hash;
+      break;
+
+    default:
+      abort ();
+    }
+
+  return make_general_lisp_hash_table (hash_function, test_function,
+				       size, rehash_size, rehash_threshold,
+				       weakness);
+}
+
+Lisp_Object
+make_general_lisp_hash_table (hash_table_hash_function_t hash_function,
+			      hash_table_test_function_t test_function,
 			      size_t size,
 			      double rehash_size,
 			      double rehash_threshold,
@@ -443,27 +480,8 @@
   Lisp_Object hash_table;
   Lisp_Hash_Table *ht = alloc_lcrecord_type (Lisp_Hash_Table, &lrecord_hash_table);
 
-  switch (test)
-    {
-    case HASH_TABLE_EQ:
-      ht->test_function = 0;
-      ht->hash_function = 0;
-      break;
-
-    case HASH_TABLE_EQL:
-      ht->test_function = lisp_object_eql_equal;
-      ht->hash_function = lisp_object_eql_hash;
-      break;
-
-    case HASH_TABLE_EQUAL:
-      ht->test_function = lisp_object_equal_equal;
-      ht->hash_function = lisp_object_equal_hash;
-      break;
-
-    default:
-      abort ();
-    }
-
+  ht->test_function = test_function;
+  ht->hash_function = hash_function;
   ht->weakness = weakness;
 
   ht->rehash_size =
@@ -505,7 +523,7 @@
 		      enum hash_table_weakness weakness,
 		      enum hash_table_test test)
 {
-  return make_general_lisp_hash_table (test, size, -1.0, -1.0, weakness);
+  return make_standard_lisp_hash_table (test, size, -1.0, -1.0, weakness);
 }
 
 /* Pretty reading of hash tables.
@@ -722,7 +740,7 @@
     }
 
   /* Create the hash table.  */
-  hash_table = make_general_lisp_hash_table
+  hash_table = make_standard_lisp_hash_table
     (decode_hash_table_test (test),
      decode_hash_table_size (size),
      decode_hash_table_rehash_size (rehash_size),
@@ -872,7 +890,7 @@
   VALIDATE_VAR (rehash_threshold);
   VALIDATE_VAR (weakness);
 
-  return make_general_lisp_hash_table
+  return make_standard_lisp_hash_table
     (decode_hash_table_test (test),
      decode_hash_table_size (size),
      decode_hash_table_rehash_size (rehash_size),
@@ -1305,6 +1323,24 @@
 		}
 	  break;
 
+	  /* We seem to be sprouting new weakness types at an alarming
+	     rate. At least this is not externally visible - and in
+	     fact all of these KEY_CAR_* types are only used by the
+	     glyph code. */
+	case HASH_TABLE_KEY_CAR_VALUE_WEAK:
+	  for (; e < sentinel; e++)
+	    if (!HENTRY_CLEAR_P (e))
+	      {
+		if (!CONSP (e->key) || marked_p (XCAR (e->key)))
+		  {
+		    MARK_OBJ (e->key);
+		    MARK_OBJ (e->value);
+		  }
+		else if (marked_p (e->value))
+		  MARK_OBJ (e->key);
+	      }
+	  break;
+
 	case HASH_TABLE_VALUE_CAR_WEAK:
 	  for (; e < sentinel; e++)
 	    if (!HENTRY_CLEAR_P (e))
--- a/src/elhash.h	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/elhash.h	Mon Aug 13 11:39:20 2007 +0200
@@ -41,6 +41,7 @@
   HASH_TABLE_KEY_VALUE_WEAK,
   HASH_TABLE_KEY_CAR_WEAK,
   HASH_TABLE_VALUE_CAR_WEAK,
+  HASH_TABLE_KEY_CAR_VALUE_WEAK,
   HASH_TABLE_WEAK
 };
 
@@ -66,7 +67,14 @@
 typedef int (*maphash_function_t) (Lisp_Object key, Lisp_Object value,
 				   void* extra_arg);
 
-Lisp_Object make_general_lisp_hash_table (enum hash_table_test test,
+Lisp_Object make_standard_lisp_hash_table (enum hash_table_test test,
+					   size_t size,
+					   double rehash_size,
+					   double rehash_threshold,
+					   enum hash_table_weakness weakness);
+
+Lisp_Object make_general_lisp_hash_table (hash_table_hash_function_t hash_function,
+					  hash_table_test_function_t test_function,
 					  size_t size,
 					  double rehash_size,
 					  double rehash_threshold,
--- a/src/event-Xt.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/event-Xt.c	Mon Aug 13 11:39:20 2007 +0200
@@ -92,6 +92,7 @@
 
 static int process_events_occurred;
 static int tty_events_occurred;
+static Widget widget_with_focus;
 
 /* Mask of bits indicating the descriptors that we wait for input on */
 extern SELECT_TYPE input_wait_mask, process_only_mask, tty_only_mask;
@@ -1536,11 +1537,12 @@
 handle_focus_event_1 (struct frame *f, int in_p)
 {
 #if XtSpecificationRelease > 5
-  Widget focus_widget = XtGetKeyboardFocusWidget (FRAME_X_TEXT_WIDGET (f));
+  widget_with_focus = XtGetKeyboardFocusWidget (FRAME_X_TEXT_WIDGET (f));
 #endif
 #ifdef HAVE_XIM
   XIM_focus_event (f, in_p);
 #endif /* HAVE_XIM */
+
   /* On focus change, clear all memory of sticky modifiers
      to avoid non-intuitive behavior. */
   clear_sticky_modifiers (XDEVICE (FRAME_DEVICE (f)));
@@ -1564,13 +1566,19 @@
      click in the frame. Why is this?  */
   if (in_p
 #if XtSpecificationRelease > 5
-      && FRAME_X_TEXT_WIDGET (f) != focus_widget
+      && FRAME_X_TEXT_WIDGET (f) != widget_with_focus
 #endif
       )
     {
       lw_set_keyboard_focus (FRAME_X_SHELL_WIDGET (f),
 			     FRAME_X_TEXT_WIDGET (f));
     }
+
+  /* We have the focus now. See comment in
+     emacs_Xt_handle_widget_losing_focus (). */
+  if (in_p)
+    widget_with_focus = NULL;
+
   /* do the generic event-stream stuff. */
   {
     Lisp_Object frm;
@@ -1587,6 +1595,23 @@
   }
 }
 
+/* The idea here is that when a widget glyph gets unmapped we don't
+   want the focus to stay with it if it has focus - because it may
+   well just get deleted next andthen we have lost the focus until the
+   user does something. So handle_focus_event_1 records the widget
+   with keyboard focus when FocusOut is processed, and then, when a
+   widget gets unmapped, it calls this function to restore focus if
+   appropriate. */
+void emacs_Xt_handle_widget_losing_focus (struct frame* f, Widget losing_widget);
+void
+emacs_Xt_handle_widget_losing_focus (struct frame* f, Widget losing_widget)
+{
+  if (losing_widget == widget_with_focus)
+    {
+      handle_focus_event_1 (f, 1);
+    }
+}
+
 /* This is called from the external-widget code */
 
 void emacs_Xt_handle_focus_event (XEvent *event);
--- a/src/frame-x.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/frame-x.c	Mon Aug 13 11:39:20 2007 +0200
@@ -2654,7 +2654,7 @@
   XFlush (XtDisplay (shell_widget)); /* hey, I'd like to DEBUG this... */
 }
 
-/* Destroy the X window of frame S.  */
+/* Destroy the X window of frame F.  */
 static void
 x_delete_frame (struct frame *f)
 {
--- a/src/frame.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/frame.c	Mon Aug 13 11:39:20 2007 +0200
@@ -3007,9 +3007,15 @@
      So deal. */
   check_frame_size (f, &newheight, &newwidth);
 
+  /* Unconditionally mark that the frame has changed size. This is
+     because many things need to know after the
+     fact. f->size_change_pending will get reset below. The most that
+     can happen is that we will cycle through redisplay once more
+     --andy. */
+  MARK_FRAME_SIZE_CHANGED (f);
+
   if (delay || in_display || gc_in_progress)
     {
-      MARK_FRAME_SIZE_CHANGED (f);
       f->new_width = newwidth;
       f->new_height = newheight;
       return;
--- a/src/glyphs-x.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/glyphs-x.c	Mon Aug 13 11:39:20 2007 +0200
@@ -156,6 +156,8 @@
 update_tab_widget_face (widget_value* wv,
 			Lisp_Image_Instance* ii, Lisp_Object domain);
 #endif
+void
+emacs_Xt_handle_widget_losing_focus (struct frame* f, Widget losing_widget);
 
 #include "bitmaps.h"
 
@@ -2130,6 +2132,12 @@
     }
   else				/* must be a widget */
     {
+      /* Since we are being unmapped we want the enclosing frame to
+	 get focus. The losing with simple scrolling but is the safest
+	 thing to do. */
+      emacs_Xt_handle_widget_losing_focus 
+	( XFRAME (IMAGE_INSTANCE_FRAME (p)),
+	  IMAGE_INSTANCE_X_WIDGET_ID (p));
       XtUnmapWidget (IMAGE_INSTANCE_X_CLIPWIDGET (p));
     }
 }
@@ -2261,7 +2269,7 @@
     }
 
   /* Adjust offsets within the frame. */
-  if (XFRAME (IMAGE_INSTANCE_FRAME (p))->frame_changed)
+  if (XFRAME (IMAGE_INSTANCE_FRAME (p))->size_changed)
     {
       Arg al[2];
       XtSetArg (al [0], XtNx, &IMAGE_INSTANCE_X_WIDGET_XOFFSET (p));
--- a/src/glyphs.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/glyphs.c	Mon Aug 13 11:39:20 2007 +0200
@@ -382,7 +382,7 @@
 	 skip it. */
       if (!(dest_mask &
 	    IIFORMAT_METH (decode_image_instantiator_format
-			   (XVECTOR_DATA (typevec)[0], ERROR_ME),
+			   (INSTANTIATOR_TYPE (typevec), ERROR_ME),
 			   possible_dest_types, ())))
 	continue;
       if (fast_string_match (exp, 0, data, 0, -1, 0, ERROR_ME, 0) >= 0)
@@ -689,7 +689,7 @@
   int governing_domain;
 
   struct image_instantiator_methods *meths =
-    decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
+    decode_image_instantiator_format (INSTANTIATOR_TYPE (instantiator),
 				      ERROR_ME);
   governing_domain = IIFORMAT_METH_OR_GIVEN (meths, governing_domain, (),
 					     GOVERNING_DOMAIN_DEVICE);
@@ -742,7 +742,7 @@
 
     GCPRO1 (instantiator);
 
-    meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
+    meths = decode_image_instantiator_format (INSTANTIATOR_TYPE (instantiator),
 					      ERROR_ME);
     RETURN_UNGCPRO (IIFORMAT_METH_OR_GIVEN (meths, normalize,
 					    (instantiator, contype, dest_mask),
@@ -765,20 +765,20 @@
   struct gcpro gcpro1;
 
   GCPRO1 (ii);
-  if (!valid_image_instantiator_format_p (XVECTOR_DATA (instantiator)[0],
+  if (!valid_image_instantiator_format_p (INSTANTIATOR_TYPE (instantiator),
 					  DOMAIN_DEVICE (governing_domain)))
     signal_simple_error
       ("Image instantiator format is invalid in this locale.",
        instantiator);
 
-  meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
+  meths = decode_image_instantiator_format (INSTANTIATOR_TYPE (instantiator),
 					    ERROR_ME);
   MAYBE_IIFORMAT_METH (meths, instantiate, (ii, instantiator, pointer_fg,
 					    pointer_bg, dest_mask, domain));
 
   /* Now do device specific instantiation. */
   device_meths = decode_device_ii_format (DOMAIN_DEVICE (governing_domain),
-					  XVECTOR_DATA (instantiator)[0],
+					  INSTANTIATOR_TYPE (instantiator),
 					  ERROR_ME_NOT);
 
   if (!HAS_IIFORMAT_METH_P (meths, instantiate)
@@ -1469,7 +1469,7 @@
   GCPRO1 (data);
   /* After normalizing the data, it's always either an image instance (which
      we filtered out above) or a vector. */
-  if (EQ (XVECTOR_DATA (data)[0], Qinherit))
+  if (EQ (INSTANTIATOR_TYPE (data), Qinherit))
     signal_simple_error ("Inheritance not allowed here", data);
   governing_domain =
     get_image_instantiator_governing_domain (data, domain);
@@ -1992,9 +1992,6 @@
   assert (XIMAGE_INSTANCE_YOFFSET (image_instance) >= 0
 	  && XIMAGE_INSTANCE_XOFFSET (image_instance) >= 0);
 
-  type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
-  meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
-
   /* If geometry is unspecified then get some reasonable values for it. */
   if (width == IMAGE_UNSPECIFIED_GEOMETRY
       ||
@@ -2002,20 +1999,11 @@
     {
       int dwidth = IMAGE_UNSPECIFIED_GEOMETRY;
       int dheight = IMAGE_UNSPECIFIED_GEOMETRY;
-
       /* Get the desired geometry. */
-      if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
-	{
-	  IIFORMAT_METH (meths, query_geometry, (image_instance, &dwidth, &dheight,
-						 IMAGE_DESIRED_GEOMETRY,
-						 domain));
-	}
-      else
-	{
-	  dwidth = IMAGE_INSTANCE_WIDTH (ii);
-	  dheight = IMAGE_INSTANCE_HEIGHT (ii);
-	}
-
+      image_instance_query_geometry (image_instance,
+				     &dwidth, &dheight,
+				     IMAGE_DESIRED_GEOMETRY,
+				     domain);
       /* Compare with allowed geometry. */
       if (width == IMAGE_UNSPECIFIED_GEOMETRY)
 	width = dwidth;
@@ -2042,12 +2030,15 @@
   IMAGE_INSTANCE_WIDTH (ii) = width;
   IMAGE_INSTANCE_HEIGHT (ii) = height;
 
-  if (IIFORMAT_METH_OR_GIVEN (meths, layout,
-			      (image_instance, width, height, xoffset, yoffset,
-			       domain), 1))
-    /* Do not clear the dirty flag here - redisplay will do this for
-       us at the end. */
-    IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 0;
+  type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
+  meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
+
+  MAYBE_IIFORMAT_METH (meths, layout,
+		       (image_instance, width, height, xoffset, yoffset,
+			domain));
+  /* Do not clear the dirty flag here - redisplay will do this for
+     us at the end. */
+  IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 0;
 }
 
 /* Update an image instance from its changed instantiator. */
@@ -3054,6 +3045,44 @@
   mark_object (IMAGE_SPECIFIER_ATTACHEE_PROPERTY (image));
 }
 
+static int
+instantiator_eq_equal (Lisp_Object obj1, Lisp_Object obj2)
+{
+  if (EQ (obj1, obj2))
+    return 1;
+
+  else if (CONSP (obj1) && CONSP (obj2))
+    {
+      return instantiator_eq_equal (XCAR (obj1), XCAR (obj2))
+	&&
+	instantiator_eq_equal (XCDR (obj1), XCDR (obj2));
+    }
+  return 0;
+}
+
+static hashcode_t
+instantiator_eq_hash (Lisp_Object obj)
+{
+  if (CONSP (obj))
+    {
+      /* no point in worrying about tail recursion, since we're not
+	 going very deep */
+      return HASH2 (instantiator_eq_hash (XCAR (obj)),
+		    instantiator_eq_hash (XCDR (obj)));
+    }
+  return LISP_HASH (obj);
+}
+
+/* We need a special hash table for storing image instances. */
+Lisp_Object
+make_image_instance_cache_hash_table (void)
+{
+  return make_general_lisp_hash_table
+    (instantiator_eq_hash, instantiator_eq_equal,
+     30, -1.0, -1.0,
+     HASH_TABLE_KEY_CAR_VALUE_WEAK);
+}
+
 static Lisp_Object
 image_instantiate_cache_result (Lisp_Object locative)
 {
@@ -3110,7 +3139,7 @@
 			       instantiator, domain);
     }
   else if (VECTORP (instantiator)
-	   && EQ (XVECTOR_DATA (instantiator)[0], Qinherit))
+	   && EQ (INSTANTIATOR_TYPE (instantiator), Qinherit))
     {
       assert (XVECTOR_LENGTH (instantiator) == 3);
       return (FACE_PROPERTY_INSTANCE
@@ -3121,7 +3150,8 @@
     {
       Lisp_Object instance = Qnil;
       Lisp_Object subtable = Qnil;
-      Lisp_Object ls3 = Qnil;
+      /* #### Should this be GCPRO'd? */
+      Lisp_Object hash_key = Qnil;
       Lisp_Object pointer_fg = Qnil;
       Lisp_Object pointer_bg = Qnil;
       Lisp_Object governing_domain =
@@ -3139,8 +3169,15 @@
 	{
 	  pointer_fg = FACE_FOREGROUND (Vpointer_face, domain);
 	  pointer_bg = FACE_BACKGROUND (Vpointer_face, domain);
-	  ls3 = list3 (glyph, pointer_fg, pointer_bg);
+	  hash_key = list4 (glyph, INSTANTIATOR_TYPE (instantiator), 
+			    pointer_fg, pointer_bg);
 	}
+      else
+	/* We cannot simply key on the glyph since fallbacks could use
+	   the same glyph but have a totally different instantiator
+	   type. Thus we key on the glyph and the type (but not any
+	   other parts of the instantiator. */
+	hash_key = list2 (glyph, INSTANTIATOR_TYPE (instantiator));
 
       /* First look in the device cache. */
       if (DEVICEP (governing_domain))
@@ -3167,20 +3204,15 @@
 		 have to use EQUAL because we massaged the
 		 instantiator into a cons3 also containing the
 		 foreground and background of the pointer face.  */
-
-	      subtable = make_lisp_hash_table
-		(20, pointerp ? HASH_TABLE_KEY_CAR_WEAK
-		 : HASH_TABLE_KEY_WEAK,
-		 pointerp ? HASH_TABLE_EQUAL
-		 : HASH_TABLE_EQ);
+	      subtable = make_image_instance_cache_hash_table ();
+
 	      Fputhash (make_int (dest_mask), subtable,
 			XDEVICE (governing_domain)->image_instance_cache);
 	      instance = Qunbound;
 	    }
 	  else
 	    {
-	      instance = Fgethash (pointerp ? ls3 : glyph,
-				   subtable, Qunbound);
+	      instance = Fgethash (hash_key, subtable, Qunbound);
 	    }
 	}
       else if (WINDOWP (governing_domain))
@@ -3188,7 +3220,7 @@
 	  /* Subwindows have a per-window cache and have to be treated
 	     differently. */
 	  instance =
-	    Fgethash (pointerp ? ls3 : glyph,
+	    Fgethash (hash_key,
 		      XWINDOW (governing_domain)->subwindow_instance_cache,
 		      Qunbound);
 	}
@@ -3201,7 +3233,7 @@
 	{
 	  Lisp_Object locative =
 	    noseeum_cons (Qnil,
-			  noseeum_cons (pointerp ? ls3 : glyph,
+			  noseeum_cons (hash_key,
 					DEVICEP (governing_domain) ? subtable
 					: XWINDOW (governing_domain)
 					->subwindow_instance_cache));
@@ -3234,7 +3266,7 @@
 #ifdef ERROR_CHECK_GLYPHS
 	  if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
 	      & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
-	    assert (EQ (Fgethash ((pointerp ? ls3 : glyph),
+	    assert (EQ (Fgethash (hash_key,
 				  XWINDOW (governing_domain)
 				  ->subwindow_instance_cache,
 				  Qunbound), instance));
@@ -3258,7 +3290,7 @@
 	     possible to make changes that don't get reflected in the
 	     display. */
 	  update_image_instance (instance, instantiator);
-	  free_list (ls3);
+	  free_list (hash_key);
 	}
 
 #ifdef ERROR_CHECK_GLYPHS
--- a/src/glyphs.h	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/glyphs.h	Mon Aug 13 11:39:20 2007 +0200
@@ -327,6 +327,8 @@
 #define IIFORMAT_INHERITS_SHARED_DEVMETHOD(type, from, format, m, fromformat) \
   (type##_##format##_image_instantiator_methods->m##_method = from##_##fromformat##_##m)
 
+#define INSTANTIATOR_TYPE(inst) (XVECTOR_DATA ((inst))[0])
+
 struct image_instantiator_methods *
 decode_device_ii_format (Lisp_Object device, Lisp_Object format,
 			 Error_behavior errb);
@@ -374,6 +376,7 @@
 		   int width, int height, int xoffset, int yoffset,
 		   Lisp_Object domain);
 int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w);
+Lisp_Object make_image_instance_cache_hash_table (void);
 
 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator,
                                                  int given_dest_mask,
--- a/src/menubar.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/menubar.c	Mon Aug 13 11:39:20 2007 +0200
@@ -115,9 +115,6 @@
 			   Lisp_Object oldval)
 {
   MARK_MENUBAR_CHANGED;
-  /* This is to force subwindow offsets to be recalculated - see
-     x_redisplay_widget (). */
-  MARK_FRAME_CHANGED (WINDOW_XFRAME (w));
 }
 
 static void
--- a/src/mule-ccl.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/mule-ccl.c	Mon Aug 13 11:39:20 2007 +0200
@@ -600,7 +600,7 @@
 
 /* If this variable is non-zero, it indicates the stack_idx
    of immediately called by CCL_MapMultiple. */
-static int stack_idx_of_map_multiple = 0;
+static int stack_idx_of_map_multiple;
 
 #define PUSH_MAPPING_STACK(restlen, orig)		\
   do {							\
--- a/src/redisplay-x.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/redisplay-x.c	Mon Aug 13 11:39:20 2007 +0200
@@ -514,7 +514,7 @@
 /*****************************************************************************
  x_bevel_area
 
- Draw a shadows for the given area in the given face.
+ Draw shadows for the given area in the given face.
  ****************************************************************************/
 static void
 x_bevel_area (struct window *w, face_index findex,
--- a/src/redisplay.h	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/redisplay.h	Mon Aug 13 11:39:20 2007 +0200
@@ -137,7 +137,7 @@
 
   union				/* Information specific to the type of rune */
   {
-    /* #### GLyphs are rare. Is it really necessary to waste 8 bytes on every
+    /* #### Glyphs are rare. Is it really necessary to waste 8 bytes on every
        rune for that?! */
     /* DGLYPH */
     struct
--- a/src/regex.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/regex.c	Mon Aug 13 11:39:20 2007 +0200
@@ -4157,7 +4157,7 @@
 
 /* Call before fetching a character with *d.  This switches over to
    string2 if necessary.  */
-#define PREFETCH()							\
+#define REGEX_PREFETCH()							\
   while (d == dend)						    	\
     {									\
       /* End of string2 => fail.  */					\
@@ -4699,7 +4699,7 @@
 		  Emchar pat_ch, buf_ch;
 		  Bytecount pat_len;
 
-		  PREFETCH ();
+		  REGEX_PREFETCH ();
 		  pat_ch = charptr_emchar (p);
 		  buf_ch = charptr_emchar (d);
 		  if (RE_TRANSLATE (buf_ch) != pat_ch)
@@ -4711,7 +4711,7 @@
 		  
 		  mcnt -= pat_len;
 #else /* not MULE */
-		  PREFETCH ();
+		  REGEX_PREFETCH ();
 		  if ((unsigned char) RE_TRANSLATE (*d++) != *p++)
                     goto fail;
 		  mcnt--;
@@ -4723,7 +4723,7 @@
 	    {
 	      do
 		{
-		  PREFETCH ();
+		  REGEX_PREFETCH ();
 		  if (*d++ != *p++) goto fail;
 		}
 	      while (--mcnt);
@@ -4736,7 +4736,7 @@
 	case anychar:
           DEBUG_PRINT1 ("EXECUTING anychar.\n");
 
-          PREFETCH ();
+          REGEX_PREFETCH ();
 
           if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
               || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
@@ -4756,7 +4756,7 @@
 
             DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
 
-	    PREFETCH ();
+	    REGEX_PREFETCH ();
 	    c = TRANSLATE (*d); /* The character to match.  */
 
             /* Cast to `unsigned' instead of `unsigned char' in case the
@@ -4783,7 +4783,7 @@
 
             DEBUG_PRINT2 ("EXECUTING charset_mule%s.\n", not ? "_not" : "");
 
-	    PREFETCH ();
+	    REGEX_PREFETCH ();
 	    c = charptr_emchar ((const Bufbyte *) d);
 	    c = TRANSLATE_EXTENDED_UNSAFE (c); /* The character to match.  */
 
@@ -5035,7 +5035,7 @@
 		if (d2 == dend2) break;
 
 		/* If necessary, advance to next segment in data.  */
-		PREFETCH ();
+		REGEX_PREFETCH ();
 
 		/* How many characters left in this segment to match.  */
 		mcnt = dend - d;
@@ -5594,7 +5594,7 @@
 	    int matches;
 	    Emchar emch;
 
-	    PREFETCH ();
+	    REGEX_PREFETCH ();
 	    emch = charptr_emchar ((const Bufbyte *) d);
 	    matches = (SYNTAX_UNSAFE
 		       (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table),
@@ -5627,7 +5627,7 @@
 	    Emchar emch;
 
 	    mcnt = *p++;
-	    PREFETCH ();
+	    REGEX_PREFETCH ();
 	    emch = charptr_emchar ((const Bufbyte *) d);
 	    INC_CHARPTR (d);
 	    if (check_category_char(emch, regex_emacs_buffer->category_table,
@@ -5645,7 +5645,7 @@
 #else /* not emacs */
 	case wordchar:
           DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
-	  PREFETCH ();
+	  REGEX_PREFETCH ();
           if (!WORDCHAR_P_UNSAFE ((int) (*d)))
             goto fail;
 	  SET_REGS_MATCHED ();
@@ -5654,7 +5654,7 @@
 
 	case notwordchar:
           DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
-	  PREFETCH ();
+	  REGEX_PREFETCH ();
           if (!WORDCHAR_P_UNSAFE ((int) (*d)))
             goto fail;
           SET_REGS_MATCHED ();
--- a/src/window.c	Mon Aug 13 11:38:26 2007 +0200
+++ b/src/window.c	Mon Aug 13 11:39:20 2007 +0200
@@ -281,9 +281,8 @@
   p->face_cachels     = Dynarr_new (face_cachel);
   p->glyph_cachels    = Dynarr_new (glyph_cachel);
   p->line_start_cache = Dynarr_new (line_start_cache);
-  p->subwindow_instance_cache = make_lisp_hash_table (30,
-						      HASH_TABLE_KEY_VALUE_WEAK,
-						      HASH_TABLE_EQ);
+  p->subwindow_instance_cache = make_image_instance_cache_hash_table ();
+
   p->line_cache_last_updated = Qzero;
   INIT_DISP_VARIABLE (last_point_x, 0);
   INIT_DISP_VARIABLE (last_point_y, 0);
@@ -3604,9 +3603,7 @@
   p->face_cachels     = Dynarr_new (face_cachel);
   p->glyph_cachels    = Dynarr_new (glyph_cachel);
   p->subwindow_instance_cache =
-    make_lisp_hash_table (30,
-			  HASH_TABLE_KEY_VALUE_WEAK,
-			  HASH_TABLE_EQ);
+    make_image_instance_cache_hash_table ();
 
   /* Put new into window structure in place of window */
   replace_window (window, new);
@@ -5478,9 +5475,8 @@
 	     set. */
 	  if (NILP (w->subwindow_instance_cache))
 	    w->subwindow_instance_cache =
-	      make_lisp_hash_table (30,
-				    HASH_TABLE_KEY_VALUE_WEAK,
-				    HASH_TABLE_EQ);
+	      make_image_instance_cache_hash_table ();
+
 	  SET_LAST_MODIFIED (w, 1);
 	  SET_LAST_FACECHANGE (w);
 	  w->config_mark = 0;
@@ -5861,14 +5857,20 @@
   /*
   config->frame_width = FRAME_WIDTH (f);
   config->frame_height = FRAME_HEIGHT (f); */
-  /* When using `push-window-configuration', often the minibuffer ends
+  /* #### When using `push-window-configuration', often the minibuffer ends
      up as the selected window because functions run as the result of
      user interaction e.g. hyper-apropos. It seems to me the sensible
-     thing to do is not record the minibuffer here. */
+     thing to do is not record the minibuffer here. 
+
+     #### Unfortunately this is a change to previous behaviour, however logical
+     it may be, so revert for the moment. */
+#if 0
   if (FRAME_MINIBUF_ONLY_P (f) || minibuf_level)
     config->current_window = FRAME_SELECTED_WINDOW (f);
   else
     config->current_window = FRAME_LAST_NONMINIBUF_WINDOW (f);
+#endif
+  config->current_window = FRAME_SELECTED_WINDOW (f);
   XSETBUFFER (config->current_buffer, current_buffer);
   config->minibuffer_scroll_window = Vminibuffer_scroll_window;
   config->root_window = FRAME_ROOT_WINDOW (f);
--- a/tests/ChangeLog	Mon Aug 13 11:38:26 2007 +0200
+++ b/tests/ChangeLog	Mon Aug 13 11:39:20 2007 +0200
@@ -1,3 +1,7 @@
+2001-01-08  Martin Buchholz <martin@xemacs.org>
+
+	* XEmacs 21.2.40 is released.
+
 2000-12-31  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.39 is released.
--- a/version.sh	Mon Aug 13 11:38:26 2007 +0200
+++ b/version.sh	Mon Aug 13 11:39:20 2007 +0200
@@ -2,8 +2,8 @@
 emacs_is_beta=t
 emacs_major_version=21
 emacs_minor_version=2
-emacs_beta_version=39
-xemacs_codename="Millennium"
+emacs_beta_version=40
+xemacs_codename="Persephone"
 infodock_major_version=4
 infodock_minor_version=0
 infodock_build_version=8