changeset 83552:d3099204c799

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-585 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-586 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-587 Update from erc--emacs--22 * emacs@sv.gnu.org/emacs--devo--0--patch-588 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-589 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-590 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-591 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-592
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 06 Jan 2007 15:25:16 +0000
parents d9dc7e67ad3f (current diff) 2788d1e56ab2 (diff)
children 32073cbc5eb6
files ChangeLog admin/FOR-RELEASE configure.in etc/TODO lib-src/etags.c lisp/ChangeLog lisp/faces.el lisp/files.el lisp/international/mule.el lisp/isearch.el lisp/progmodes/ebrowse.el lisp/progmodes/gdb-ui.el lisp/simple.el lisp/subr.el lispref/ChangeLog lwlib/xlwmenu.c man/ChangeLog man/cc-mode.texi src/gtkutil.c src/indent.c src/macterm.c src/macterm.h src/minibuf.c src/window.c
diffstat 80 files changed, 2224 insertions(+), 835 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,9 @@
+2007-01-02  Stephen C. Gilardi  <scgilardi@gmail.com>  (tiny change)
+
+	* configure.in: Detect and use fink-installed in intel-based Mac
+	builds; change Apple Darwin section to support both PowerPC and
+	Intel-based Macs.
+
 2006-12-26  Andreas Schwab  <schwab@suse.de>
 
 	* Makefile.in (datarootdir): Define.
--- a/admin/FOR-RELEASE	Mon Jan 01 18:32:06 2007 +0000
+++ b/admin/FOR-RELEASE	Sat Jan 06 15:25:16 2007 +0000
@@ -1,5 +1,8 @@
 Tasks needed before the next release.
 
+* UPDATE COPYRIGHTS (Happy New Year :-)
+
+
 * TO BE DONE SHORTLY BEFORE RELEASE
 
 ** Check for widow and orphan lines in manuals;
@@ -8,7 +11,6 @@
 ** Check for text in manuals that assumes current version is 21.
 
 ** Update AUTHORS.
-[Done 2006-10-03]
 
 ** Regenerate the postscript files of the reference cards in etc.
 
@@ -48,8 +50,6 @@
 
 * BUGS
 
-** document gpg-agent.
-
 ** Need papers from Rubini for his code in t-mouse.el
   Sent instructions.
 
@@ -63,8 +63,6 @@
 ** lennart.borgman.073@student.lu.se, Dec 16:
   compilation-previous-error fails if first error is at start of buffer
 
-** CC mode fixes to be installed.
-
 ** W3 status with latest url package.
 
 ** Fix up the notices in oldXMenu properly.
@@ -74,9 +72,7 @@
 ** disumu@x3y2z1.net, Nov 22:
   URL not following some 302 redirects after recent changes
 
-** Give recommendations for redefining window manager keys
-  to avoid interference with Emacs.
-
+** storm@cua.dk, Jan 2: Bug in incremental undrawing of mouseover highlighting
 ** lennart.borgman.073@student.lu.se, Dec 29:
   How global is a define-global-minor-mode mode
 He says that customizing such a mode simply does not work.
@@ -92,6 +88,13 @@
 
 ** pgg bugs reported by rms.
 
+** (global-set-key "\M-k" 'bury-buffer) confuses tutorial warnings.
+
+** jpff@cs.bath.ac.uk, Jan 5: Failure to submit second netnews message
+
+** KSNetz@UseNet.ArcorNews.DE, Jan 5: 
+    url-http.el: calling the callback function for proxy connections
+
 * DOCUMENTATION
 
 ** Check the Emacs Tutorial.
--- a/configure.in	Mon Jan 01 18:32:06 2007 +0000
+++ b/configure.in	Sat Jan 06 15:25:16 2007 +0000
@@ -378,6 +378,24 @@
     machine=apollo opsys=bsd4-3
   ;;
 
+  ## Apple Darwin / Mac OS X
+  *-apple-darwin* )
+    case "${canonical}" in
+      i[3456]86-* )  machine=intel386 ;;
+      powerpc-* )    machine=powermac ;;
+      * )            unported=yes ;;
+    esac
+    opsys=darwin
+    # Define CPP as follows to make autoconf work correctly.
+    CPP="${CC-cc} -E -no-cpp-precomp"
+    # Use fink packages if available.
+    if test -d /sw/include && test -d /sw/lib; then
+      GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
+      CPP="${CPP} ${GCC_TEST_OPTIONS}"
+      NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
+    fi
+  ;;
+
   ## AT&T 3b2, 3b5, 3b15, 3b20
   we32k-att-sysv* )
     machine=att3b opsys=usg5-2-2
@@ -1154,19 +1172,6 @@
     machine=f301 opsys=uxpv
   ;;
 
-  ## Darwin / Mac OS X
-  powerpc-apple-darwin* )
-    machine=powermac opsys=darwin
-    # Define CPP as follows to make autoconf work correctly.
-    CPP="${CC-cc} -E -no-cpp-precomp"
-    # Use fink packages if available.
-    if test -d /sw/include && test -d /sw/lib; then
-	GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
-        CPP="${CPP} ${GCC_TEST_OPTIONS}"
-	NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
-    fi
-  ;;
-
   ## AMD x86-64 Linux-based GNU system
   x86_64-*-linux-gnu* )
     machine=amdx86-64 opsys=gnu-linux
--- a/etc/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/etc/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,7 @@
+2006-06-30  Francesco Potort,Al(B  <pot@gnu.org>
+
+	* etags.1: Undocument the --no-warn option.
+
 2006-12-17  Richard Stallman  <rms@gnu.org>
 
 	* TUTORIAL: Say that C-d and DEL with arg do killing.
--- a/etc/ERC-NEWS	Mon Jan 01 18:32:06 2007 +0000
+++ b/etc/ERC-NEWS	Sat Jan 06 15:25:16 2007 +0000
@@ -8,6 +8,20 @@
 `erc-ssl' with `erc-select-ssl' as its alias.  The function that was
 known as `erc' is now `erc-open'.
 
+** New command: /RECONNECT
+This command tries to reconnect to the current IRC server exactly
+once.  It does not work in server buffers (throws an error before the
+command is run), but works in query and channel buffers.
+
+** New options
+
+*** erc-server-reconnect-attempts: Determines the number of
+reconnection attempts that ERC will make per server.
+
+*** erc-server-reconnect-timeout: New option that determines the
+amount of time, in seconds, that ERC will wait between successive
+reconnect attempts.
+
 ** Changes and additions to modules
 
 *** Channel lists (erc-list.el)
--- a/etc/TODO	Mon Jan 01 18:32:06 2007 +0000
+++ b/etc/TODO	Sat Jan 06 15:25:16 2007 +0000
@@ -79,6 +79,8 @@
 
 ** The toolbar should show keyboard equivalents in its tooltips.
 
+** Add function to redraw the tool bar.
+
 ** Modify allout.el to use overlays, like outline.el.
 
 ** M-! M-n should fetch the buffer-file-name as the default.
--- a/etc/etags.1	Mon Jan 01 18:32:06 2007 +0000
+++ b/etc/etags.1	Sat Jan 06 15:25:16 2007 +0000
@@ -37,7 +37,7 @@
 [\|\-\-language=\fIlanguage\fP\|] [\|\-\-members\|]
 [\|\-\-output=\fItagfile\fP\|] [\|\-\-regex=\fIregexp\fP\|]
 [\|\-\-typedefs\|] [\|\-\-typedefs\-and\-c++\|]
-[\|\-\-update\|] [\|\-\-no\-warn\|]
+[\|\-\-update\|]
 [\|\-\-help\|] [\|\-\-version\|]
 \fIfile\fP .\|.\|.
 .ad b
@@ -262,11 +262,6 @@
 Instead of generating a tag file, write index (in \fBvgrind\fP format)
 to standard output.  Only \fBctags\fP accepts this option.
 .TP
-.B \-w, \-\-no\-warn
-Suppress warning messages about duplicate entries.  The \fBetags\fP
-program does not check for duplicate entries, so this option is not
-allowed with it.
-.TP
 .B \-x, \-\-cxref
 Instead of generating a tag file, write a cross reference (in
 \fBcxref\fP format) to standard output.  Only \fBctags\fP accepts this option.
--- a/lib-src/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/lib-src/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,11 @@
+2007-01-02  Francesco Potort,Al(B  <pot@gnu.org>
+
+	* etags.c: (longopts): New undocumented option --no-duplicates.
+	(no_duplicates): Static variables for the above option.
+	(print_help): Do not print help for --no-warn, now undocumented.
+	(add_node): Allow duplicate tags in ctags mode unless --no-duplicates.
+	(main): Pass the -u option to sort in ctags mode.
+
 2006-12-28  Francesco Potort,Al(B  <pot@gnu.org>
 
 	* etags.c (readline): When creating a relative file name from a
--- a/lib-src/etags.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/lib-src/etags.c	Sat Jan 06 15:25:16 2007 +0000
@@ -41,7 +41,7 @@
  * configuration file containing regexp definitions for etags.
  */
 
-char pot_etags_version[] = "@(#) pot revision number is 17.25";
+char pot_etags_version[] = "@(#) pot revision number is 17.26";
 
 #define	TRUE	1
 #define	FALSE	0
@@ -456,9 +456,10 @@
 static bool declarations;	/* --declarations: tag them and extern in C&Co*/
 static bool members;		/* create tags for C member variables */
 static bool no_line_directive;	/* ignore #line directives (undocumented) */
+static bool no_duplicates;	/* no duplicate tags for ctags (undocumented) */
 static bool update;		/* -u: update tags */
 static bool vgrind_style;	/* -v: create vgrind style index output */
-static bool no_warnings;	/* -w: suppress warnings */
+static bool no_warnings;	/* -w: suppress warnings (undocumented) */
 static bool cxref_style;	/* -x: create cxref style output */
 static bool cplusplus;		/* .[hc] means C++, not C */
 static bool ignoreindent;	/* -I: ignore indentation in C */
@@ -477,39 +478,40 @@
 
 static struct option longopts[] =
 {
-  { "append",		  no_argument,	     NULL,	     	 'a'   },
-  { "packages-only",      no_argument,	     &packages_only, 	 TRUE  },
-  { "c++",		  no_argument,	     NULL,	     	 'C'   },
-  { "declarations",	  no_argument,	     &declarations,  	 TRUE  },
-  { "no-line-directive",  no_argument,	     &no_line_directive, TRUE  },
-  { "help",		  no_argument,	     NULL,     	     	 'h'   },
-  { "help",		  no_argument,	     NULL,     	     	 'H'   },
-  { "ignore-indentation", no_argument,	     NULL,     	     	 'I'   },
-  { "language",           required_argument, NULL,     	     	 'l'   },
-  { "members",		  no_argument,	     &members, 	     	 TRUE  },
-  { "no-members",	  no_argument,	     &members, 	     	 FALSE },
-  { "output",		  required_argument, NULL,	     	 'o'   },
-  { "regex",		  required_argument, NULL,	     	 'r'   },
-  { "no-regex",		  no_argument,	     NULL,	     	 'R'   },
-  { "ignore-case-regex",  required_argument, NULL,	     	 'c'   },
+  { "append",             no_argument,       NULL,               'a'   },
+  { "packages-only",      no_argument,       &packages_only,     TRUE  },
+  { "c++",                no_argument,       NULL,               'C'   },
+  { "declarations",       no_argument,       &declarations,      TRUE  },
+  { "no-line-directive",  no_argument,       &no_line_directive, TRUE  },
+  { "no-duplicates",      no_argument,       &no_duplicates,     TRUE  },
+  { "help",               no_argument,       NULL,               'h'   },
+  { "help",               no_argument,       NULL,               'H'   },
+  { "ignore-indentation", no_argument,       NULL,               'I'   },
+  { "language",           required_argument, NULL,               'l'   },
+  { "members",            no_argument,       &members,           TRUE  },
+  { "no-members",         no_argument,       &members,           FALSE },
+  { "output",             required_argument, NULL,               'o'   },
+  { "regex",              required_argument, NULL,               'r'   },
+  { "no-regex",           no_argument,       NULL,               'R'   },
+  { "ignore-case-regex",  required_argument, NULL,               'c'   },
   { "parse-stdin",        required_argument, NULL,               STDIN },
-  { "version",		  no_argument,	     NULL,     	     	 'V'   },
+  { "version",            no_argument,       NULL,               'V'   },
 
 #if CTAGS /* Ctags options */
-  { "backward-search",	  no_argument,	     NULL,	     	 'B'   },
-  { "cxref",		  no_argument,	     NULL,	     	 'x'   },
-  { "defines",		  no_argument,	     NULL,	     	 'd'   },
-  { "globals",		  no_argument,	     &globals, 	     	 TRUE  },
-  { "typedefs",		  no_argument,	     NULL,	     	 't'   },
-  { "typedefs-and-c++",	  no_argument,	     NULL,     	     	 'T'   },
-  { "update",		  no_argument,	     NULL,     	     	 'u'   },
-  { "vgrind",		  no_argument,	     NULL,     	     	 'v'   },
-  { "no-warn",		  no_argument,	     NULL,	     	 'w'   },
+  { "backward-search",    no_argument,       NULL,               'B'   },
+  { "cxref",              no_argument,       NULL,               'x'   },
+  { "defines",            no_argument,       NULL,               'd'   },
+  { "globals",            no_argument,       &globals,           TRUE  },
+  { "typedefs",           no_argument,       NULL,               't'   },
+  { "typedefs-and-c++",   no_argument,       NULL,               'T'   },
+  { "update",             no_argument,       NULL,               'u'   },
+  { "vgrind",             no_argument,       NULL,               'v'   },
+  { "no-warn",            no_argument,       NULL,               'w'   },
 
 #else /* Etags options */
-  { "no-defines",	  no_argument,	     NULL,	     	 'D'   },
-  { "no-globals",	  no_argument,	     &globals, 	     	 FALSE },
-  { "include",		  required_argument, NULL,     	     	 'i'   },
+  { "no-defines",         no_argument,       NULL,               'D'   },
+  { "no-globals",         no_argument,       &globals,           FALSE },
+  { "include",            required_argument, NULL,               'i'   },
 #endif
   { NULL }
 };
@@ -976,9 +978,13 @@
         Print on the standard output an index of items intended for\n\
         human consumption, similar to the output of vgrind.  The index\n\
         is sorted, and gives the page number of each item.");
+# if PRINT_UNDOCUMENTED_OPTIONS_HELP
+      puts ("-w, --no-duplicates\n\
+        Do not create duplicate tag entries, for compatibility with\n\
+	traditional ctags.");
       puts ("-w, --no-warn\n\
-        Suppress warning messages about entries defined in multiple\n\
-        files.");
+        Suppress warning messages about duplicate tag entries.");
+# endif /* PRINT_UNDOCUMENTED_OPTIONS_HELP */
       puts ("-x, --cxref\n\
         Like --vgrind, but in the style of cxref, rather than vgrind.\n\
         The output uses line numbers instead of page numbers, but\n\
@@ -1454,8 +1460,11 @@
   if (CTAGS)
     if (append_to_tagfile || update)
       {
-	char cmd[2*BUFSIZ+10];
-	sprintf (cmd, "sort -o %.*s %.*s", BUFSIZ, tagfile, BUFSIZ, tagfile);
+	char cmd[2*BUFSIZ+20];
+	/* Maybe these should be used:
+	   setenv ("LC_COLLATE", "C", 1);
+	   setenv ("LC_ALL", "C", 1); */
+	sprintf (cmd, "sort -u -o %.*s %.*s", BUFSIZ, tagfile, BUFSIZ, tagfile);
 	exit (system (cmd));
       }
   return EXIT_SUCCESS;
@@ -2168,7 +2177,7 @@
        * If this tag name matches an existing one, then
        * do not add the node, but maybe print a warning.
        */
-      if (!dif)
+      if (no_duplicates && !dif)
 	{
 	  if (np->fdp == cur_node->fdp)
 	    {
@@ -6885,6 +6894,7 @@
  * tab-width: 8
  * fill-column: 79
  * c-font-lock-extra-types: ("FILE" "bool" "language" "linebuffer" "fdesc" "node" "regexp")
+ * c-file-style: gnu
  * End:
  */
 
--- a/lisp/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,173 @@
+2007-01-05  Takaaki Ota  <Takaaki.Ota@am.sony.com>
+
+	* textmodes/table.el (table--warn-incompatibility):
+	Use display-warning instead of momentary-string-display.
+
+2007-01-05  Richard Stallman  <rms@gnu.org>
+
+	* image.el (image-type-header-regexps): Recognize xbm more strictly.
+
+	* simple.el (backward-kill-word): Doc fix.
+
+2007-01-05  Romain Francoise  <romain@orebokech.com>
+
+	* international/mule.el (sgml-html-meta-auto-coding-function):
+	Ensure that the buffer contains a HTML document.
+
+2007-01-05  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* faces.el (momentary): Move here ...
+	* subr.el (momentary): ... from here.
+
+2007-01-05  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-max-children): New customizable variable.
+	(gdb-speedbar-expand-node): Ask user for confirmation before expanding
+	large structures/arrays.
+
+2007-01-04  Juanma Barranquero  <lekktu@gmail.com>
+
+	* files.el (find-file-noselect-1, set-visited-file-name):
+	Allow backup-enable-predicate to be nil.
+
+2007-01-04  Kevin Rodgers  <kevin.d.rodgers@gmail.com>
+
+	* subr.el (momentary): New face.
+	(momentary-string-display): Display the string via a temporary
+	overlay using the new face, instead of inserting it in the buffer.
+
+2007-01-04  Andreas Schwab  <schwab@suse.de>
+
+	* progmodes/ebrowse.el (ebrowse-global-prefix-key): Fix typo in
+	last change.
+
+2007-01-03  Richard Stallman  <rms@gnu.org>
+
+	* woman.el (woman-decode-buffer): Clarify error message.
+
+2007-01-03  Alan Mackenzie  <acm@muc.de>
+
+	* progmode/cc-cmds.el (c-mask-paragraph): Fix yesterday's buggy
+	patch.
+
+2007-01-03  Chris Moore  <christopher.ian.moore@gmail.com>  (tiny change)
+
+	* tutorial.el (tutorial--describe-nonstandard-key): Fix typo.
+
+2007-01-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* iswitchb.el (iswitchb-global-map): Use command-remapping if available.
+
+2007-01-02  Juanma Barranquero  <lekktu@gmail.com>
+
+	* emulation/viper.el (viper-custom-file-name, viper-mode):
+	Fix typos in docstrings.
+
+	* subr.el (momentary-string-display): After moving point, set POS
+	variable to it to avoid later errors once the buffer is modified.
+	Doc fix.
+
+2007-01-02  Alan Mackenzie  <acm@muc.de>
+
+	* progmodes/cc-cmds.el (c-mask-paragraph): In a block comment,
+	check that the "*/" is present before trying to manipulate it.
+
+2007-01-02  Richard Stallman  <rms@gnu.org>
+
+	* wid-edit.el (widget-choose): Avoid ugly error for function keys.
+
+	* progmodes/cfengine.el (cfengine-font-lock-syntactic-keywords):
+	Fix format of value.
+
+	* cus-edit.el (customize-unsaved): Rename from customize-customized.
+	Change messages accordingly.
+	(customize-customized): Now alias.
+
+2007-01-02  Juanma Barranquero  <lekktu@gmail.com>
+
+	* files.el (version-control): Doc fix.
+
+2007-01-01  Alan Mackenzie  <acm@muc.de>
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax, case 5N):
+	Check the format of c-state-cache is valid for an optimisation before
+	using it.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): New case 5Q "we
+	are at a statement within a macro".  Other changes so that only
+	the first continuation line in a macro gets the symbol
+	`cpp-define-intro', the others getting `statement', or whatever.
+
+	* progmodes/cc-cmds.el (c-context-line-break): When invoked within
+	a string, preserve whitespace.  Add a backslash only when also in
+	a macro.
+
+	* progmodes/cc-defs.el: Correct typos.
+
+	* progmodes/cc-cmds.el (c-context-line-break): Don't indent the
+	new line after an escaped EOL in a string.
+
+	* progmodes/cc-engine.el (c-forward-label): Recognise "foo:" as a
+	label when it directly follows "else", "do", ....
+
+	* progmodes/cc-engine.el (c-backward-<>-arglist): Tolerate empty
+	angle brackets (as seen in "explicit specialisations" of C++
+	templates).
+
+	* progmodes/cc-vars.el (c-indentation-style): Mention c-file-style
+	in the doc-string.
+
+	* progmodes/cc-cmds.el (c-mask-paragraph): Fix for C comments,
+	when the comment ender looks like "=========*/" and is alone on
+	its line.
+
+	* progmodes/cc-langs.el, progmodes/cc-engine.el: Correct the
+	spelling of c-opt-op-identiTier-prefix, t -> f.  Leave an alias
+	for the old name.
+
+	* progmodes/cc-mode.el: Bind C-M-a and C-M-e to
+	c-\(beginning\|end\)-of-defun by default.
+
+	* progmodes/cc-align.el (c-lineup-gnu-DEFUN-intro-cont):
+	New line-up function, for the DEFUN macro in the Emacs C sources.
+	Only used in "gnu" style.
+
+	* progmodes/cc-styles.el (c-style-alist): Use this new function in
+	the "gnu" style.
+
+	* progmodes/cc-cmds.el (c-electric-slash): Extend the handling of
+	clean-up comment-close-slash also to work when there's a comment
+	terminator on the line.
+	(c-beginning-of-defun, c-end-of-defun): Refactor and optimise
+	these for large arg - only take account of top level {..}, except
+	for initial and final adjustments.  M-- C-M-[ae] now go to the
+	right defuns when the starting point is between defuns.  They use
+	the four new functions:
+	(c-in-function-trailer-p, c-where-wrt-brace-construct)
+	(c-backward-to-nth-BOF-{, c-forward-to-nth-EOF-}): New functions to
+	support c-\(beginning\|end\)-of-defun.
+
+	* progmodes/cc-engine.el (c-forward-label): Analyze ":"
+	expressions more rigorously, to exclude bit-field specifiers from
+	being classed as labels.
+	(c-forward-label): When analyzing a ":" within a macro, be careful
+	about using c-forward-syntactic-ws at the macro beginning.
+	(c-beginning-of-decl-1): Whilst searching for "=" as evidence of a
+	stmt boundary, check for "operator=", etc.
+
+	* progmodes/cc-mode.el (c-postprocess-file-styles):
+	Bind inhibit-read-only to t, around the call to
+	c-remove-any-local-eval-or-mode-variables, so that it works on a
+	RO file.
+
+	* progmodes/cc-defs.el (c-version): Update the version number to
+	"5.31.4".
+
+2007-01-01  Richard Stallman  <rms@gnu.org>
+
+	* isearch.el (isearch-done): Use FOUND-POINT or FOUND-START
+	only if we restored isearch-window-configuration.
+
 2006-12-31  Romain Francoise  <romain@orebokech.com>
 
 	* net/tramp.el (tramp-default-method): Don't use `symbol-function'.
@@ -165,9 +335,9 @@
 
 2006-12-25  Michael R. Mauger  <mmaug@yahoo.com>
 
-	* progmodes/sql.el (sql-mode-abbrev-table): Corrected initialization.
+	* progmodes/sql.el (sql-mode-abbrev-table): Correct initialization.
 	(sql-mode-syntax-table): Disable double quoted strings.
-	(sql-mode-font-lock-object-name): Added TYPE and TYPE BODY.
+	(sql-mode-font-lock-object-name): Add TYPE and TYPE BODY.
 
 2006-12-25  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
@@ -2216,8 +2386,8 @@
 
 2006-10-19  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* select.el (ccl-check-utf-8, string-utf-8-p): New functions
-	(by Kenichi Handa).
+	* select.el (ccl-check-utf-8, string-utf-8-p): New functions (by
+	Kenichi Handa).
 	(xselect-convert-to-string): Decline requests for UTF8_STRING if
 	the selection is not UTF-8.
 
--- a/lisp/cus-edit.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/cus-edit.el	Sat Jan 06 15:25:16 2007 +0000
@@ -1320,9 +1320,11 @@
      (format "*Customize Face: %s*"
 	     (custom-unlispify-tag-name face)))))
 
+(defalias 'customize-customized 'customize-unsaved)
+
 ;;;###autoload
-(defun customize-customized ()
-  "Customize all user options set since the last save in this session."
+(defun customize-unsaved ()
+  "Customize all user options set in this session but not saved."
   (interactive)
   (let ((found nil))
     (mapatoms (lambda (symbol)
@@ -1335,9 +1337,9 @@
 		     (boundp symbol)
 		     (push (list symbol 'custom-variable) found))))
     (if (not found)
-	(error "No customized user options")
+	(error "No user options are set but unsaved")
       (custom-buffer-create (custom-sort-items found t nil)
-			    "*Customize Customized*"))))
+			    "*Customize Unsaved*"))))
 
 ;;;###autoload
 (defun customize-rogue ()
--- a/lisp/emulation/viper.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/emulation/viper.el	Sat Jan 06 15:25:16 2007 +0000
@@ -325,7 +325,7 @@
 
 ;; better be defined before Viper custom group.
 (defvar viper-custom-file-name (convert-standard-filename "~/.viper")
-  "Viper customisation file.
+  "Viper customization file.
 If set by the user, this must be done _before_ Viper is loaded in `~/.emacs'.")
 
 (defgroup viper nil
@@ -360,7 +360,7 @@
 			    (t 'ask))
   "To Viperize or not to Viperize.
 If t, viperize Emacs.  If nil -- don't.  If `ask', ask the user.
-This variable is used primatily when Viper is being loaded.
+This variable is used primarily when Viper is being loaded.
 
 Must be set in `~/.emacs' before Viper is loaded.
 DO NOT set this variable interactively, unless you are using the customization
--- a/lisp/erc/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/erc/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,56 @@
+2006-12-28  Michael Olson  <mwolson@gnu.org>
+
+	* erc-list.el: Change header to mention that this is part of ERC,
+	rather than GNU Emacs.
+
+	* erc-networks.el (erc-server-alist): Add Ars OpenIRC and
+	LinuxChix networks.  Thanks to Angelina Carlton for mentioning
+	them.  Properly escape periods in Konfido.Net and Kewl.Org.
+	(erc-networks-alist): Add entries for Ars and LinuxChix, though
+	the latter does not actually provide an announced network name.
+
+	* erc-services.el (erc-nickserv-identify-mode): Add 'both method,
+	which waits for a NickServ message if the network supports it,
+	otherwise sends the password after connecting.
+	(erc-nickserv-identify-mode): Default to 'both.
+	(erc-nickserv-passwords): Add OFTC and Azzurra to custom options.
+	(erc-nickserv-alist): Indentation fix.
+	(erc-nickserv-identify-on-connect)
+	(erc-nickserv-identify-on-nick-change): Handle 'both method.
+
+2006-12-28  Leo  <sdl.web@gmail.com>  (tiny change)
+
+	* erc.el (erc-iswitchb): Wrap body in unwind-protect so that
+	hitting C-g does not leave iswitchb-mode on.
+
+2006-12-27  Michael Olson  <mwolson@gnu.org>
+
+	* erc.el (erc-cmd-RECONNECT): New command that calls
+	erc-server-reconnect.
+
+	* erc-backend.el (erc-server-reconnect-count): New server variable
+	that keeps track of reconnection attempts.
+	(erc-server-reconnect-attempts): New option that determines the
+	number of reconnection attempts that ERC will make per server.
+	(erc-server-reconnect-timeout): New option that determines the
+	amount of time, in seconds, that ERC will wait between successive
+	reconnect attempts.
+	(erc-server-reconnect): New function that reestablishes the
+	current IRC connection.  Move some commands from
+	erc-process-sentinel-1 here.
+	(erc-process-sentinel-1): If we have been disconnected, loop until
+	we either reconnect or run out of attempts.
+	(erc-server-reconnect-p): Move higher and make this a defsubst,
+	since I'm worried about the current buffer changing from
+	underneath us.  Implement limit of number of reconnect attempts..
+
+	* erc.texi (Getting Started): Update for /RECONNECT command.
+
+2006-12-26  Michael Olson  <mwolson@gnu.org>
+
+	* erc.el (erc-open): Restore old point correctly, or at least get
+	closer to doing so than before.
+
 2006-12-13  Leo  <sdl.web@gmail.com>  (tiny change)
 
 	* erc.el (erc-iswitchb): Temporarily enable iswitchb mode if it
@@ -38,7 +91,7 @@
 	(erc-update-current-channel-member, erc-load-script):
 	(erc-mode-line-away-status-format): Doc fixes.
 
-2006-11-20  Andrea Russo  <rastandy@inventati.org>
+2006-11-20  Andrea Russo  <rastandy@inventati.org>  (tiny change)
 
 	* erc-dcc.el (erc-dcc-chat-setup): Initialize `erc-input-marker'
 	before calling `erc-display-prompt'.
@@ -111,7 +164,7 @@
 	`erc-show-my-nick' is non-nil.
 	(erc-compute-server): Doc fix.
 
-2006-10-01  John J Foerch  <jjfoerch@earthlink.net>
+2006-10-01  John J Foerch  <jjfoerch@earthlink.net>  (tiny change)
 
 	* erc-stamp.el (erc-insert-timestamp-right): Exclude the newline
 	from the erc-timestamp field.
@@ -121,7 +174,7 @@
 	* erc-nicklist.el (erc-nicklist-insert-contents): Add missing
 	parenthesis.  Thanks to Stephan Stahl for the report.
 
-2006-09-10  Eric Hanchrow  <offby1@blarg.net>
+2006-09-10  Eric Hanchrow  <offby1@blarg.net>  (tiny change)
 
 	* erc.el (erc-cmd-IGNORE): Prompt user if this might be a regexp
 	instead of a single user.
@@ -230,6 +283,13 @@
 
 	* NEWS: Added note about these changes.
 
+2006-08-20  Diane Murray  <disumu@x3y2z1.net>
+
+	* erc-backend.el (erc-process-sentinel-1): Doc fix.  Let
+	`erc-server-reconnect-p' check all condition cases.
+	(erc-server-reconnect-p): Moved rest of checks from
+	`erc-process-sentinel-1' to here.  Now takes an argument, EVENT.
+
 2006-08-21  Diane Murray  <disumu@x3y2z1.net>
 
 	* erc-track.el (erc-track-mode-line-mouse-face): New variable.
@@ -242,6 +302,18 @@
 	(erc-menu-definition): Name the menu "ERC" instead of "IRC" to
 	avoid confusion with rcirc and other clients.
 
+	* erc-backend.el (erc-server-banned): New variable.
+	(erc-server-connect): Set `erc-server-banned' to nil.
+	(erc-process-sentinel-1): Use `erc-server-reconnect-p'.
+	(erc-server-reconnect-p): New function.  Return non-nil if the
+	user wants automatic reconnects and if the user has not been
+	banned from the server.  This should fix a bug where ERC gets into
+	a loop trying to reconnect with no way to stop it when the user is
+	denied access to the server due to a server ban.  It might also
+	help when Tor users are blocked from freenode if freenode servers
+	send the 465 message before disconnecting.
+	(465): Handle "banned from server" error notices.
+
 2006-08-13  Romain Francoise  <romain@orebokech.com>
 
 	* erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p'
--- a/lisp/erc/erc-backend.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/erc/erc-backend.el	Sat Jan 06 15:25:16 2007 +0000
@@ -179,10 +179,18 @@
 This variable is buffer-local.")
 (make-variable-buffer-local 'erc-server-connected)
 
+(defvar erc-server-reconnect-count 0
+  "Number of times we have failed to reconnect to the current server.")
+(make-variable-buffer-local 'erc-server-reconnect-count)
+
 (defvar erc-server-quitting nil
   "Non-nil if the user requests a quit.")
 (make-variable-buffer-local 'erc-server-quitting)
 
+(defvar erc-server-banned nil
+  "Non-nil if the user is denied access because of a server ban.")
+(make-variable-buffer-local 'erc-server-banned)
+
 (defvar erc-server-lines-sent nil
   "Line counter.")
 (make-variable-buffer-local 'erc-server-lines-sent)
@@ -259,6 +267,23 @@
   :group 'erc-server
   :type 'boolean)
 
+(defcustom erc-server-reconnect-attempts 2
+  "The number of times that ERC will attempt to reestablish a
+broken connection, or t to always attempt to reconnect.
+
+This only has an effect if `erc-server-auto-reconnect' is non-nil."
+  :group 'erc-server
+  :type '(choice (const :tag "Always reconnect" t)
+                 integer))
+
+(defcustom erc-server-reconnect-timeout 1
+  "The amount of time, in seconds, that ERC will wait between
+successive reconnect attempts.
+
+If a key is pressed while ERC is waiting, it will stop waiting."
+  :group 'erc-server
+  :type 'number)
+
 (defcustom erc-split-line-length 440
   "*The maximum length of a single message.
 If a message exceeds this size, it is broken into multiple ones.
@@ -434,6 +459,7 @@
     (message "%s...done" msg))
   ;; Misc server variables
   (setq erc-server-quitting nil)
+  (setq erc-server-banned nil)
   (setq erc-server-last-sent-time (erc-current-time))
   (setq erc-server-last-ping-time (erc-current-time))
   (setq erc-server-lines-sent 0)
@@ -457,6 +483,21 @@
                            "Opening connection..\n")
     (erc-login)))
 
+(defun erc-server-reconnect ()
+"Reestablish the current IRC connection.
+Make sure you are in an ERC buffer when running this."
+  (let ((server (erc-server-buffer)))
+    (unless (and server
+                 (buffer-live-p server))
+      (error "Couldn't switch to server buffer"))
+    (with-current-buffer server
+      (erc-update-mode-line)
+      (erc-set-active-buffer (current-buffer))
+      (setq erc-server-last-sent-time 0)
+      (setq erc-server-lines-sent 0)
+      (erc-open erc-session-server erc-session-port erc-server-current-nick
+                erc-session-user-full-name t erc-session-password))))
+
 (defun erc-server-filter-function (process string)
   "The process filter for the ERC server."
   (with-current-buffer (process-buffer process)
@@ -485,11 +526,24 @@
                                (match-end 0))))
             (erc-parse-server-response process line)))))))
 
+(defsubst erc-server-reconnect-p (event)
+  "Return non-nil if ERC should attempt to reconnect automatically.
+EVENT is the message received from the closed connection process."
+  (and erc-server-auto-reconnect
+       (not erc-server-banned)
+       ;; make sure we don't infinitely try to reconnect, unless the
+       ;; user wants that
+       (or (eq erc-server-reconnect-attempts t)
+           (and (integerp erc-server-reconnect-attempts)
+                (< erc-server-reconnect-count erc-server-reconnect-attempts)))
+       (not (string-match "^deleted" event))
+       ;; open-network-stream-nowait error for connection refused
+       (not (string-match "^failed with code 111" event))))
+
 (defun erc-process-sentinel-1 (event)
-  "This will be called when erc-process-sentinel has decided that we
-are going to quit.  Determine whether user has quit or whether erc has
-been terminated.  Conditionally try to reconnect and take appropriate
-action."
+  "Called when `erc-process-sentinel' has decided that we're disconnecting.
+Determine whether user has quit or whether erc has been terminated.
+Conditionally try to reconnect and take appropriate action."
   (if erc-server-quitting
       ;; normal quit
       (progn
@@ -498,25 +552,26 @@
           (set-buffer-modified-p nil)
           (kill-buffer (current-buffer))))
     ;; unexpected disconnect
-    (erc-display-message nil 'error (current-buffer)
-                         (if erc-server-auto-reconnect
-                             'disconnected
-                           'disconnected-noreconnect))
-    (erc-update-mode-line)
-    (erc-set-active-buffer (current-buffer))
-    (setq erc-server-last-sent-time 0)
-    (setq erc-server-lines-sent 0)
-    (if (and erc-server-auto-reconnect
-             (not (string-match "^deleted" event))
-             ;; open-network-stream-nowait error for connection refused
-             (not (string-match "^failed with code 111" event)))
-        ;; Yuck, this should perhaps funcall
-        ;; erc-server-reconnect-function with no args
-        (erc-open erc-session-server erc-session-port erc-server-current-nick
-                  erc-session-user-full-name t erc-session-password)
-      ;; terminate, do not reconnect
-      (erc-display-message nil 'error (current-buffer)
-                           'terminated ?e event))))
+    (let ((again t))
+      (while again
+        (setq again nil)
+        (erc-display-message nil 'error (current-buffer)
+                             (if (erc-server-reconnect-p event)
+                                 'disconnected
+                               'disconnected-noreconnect))
+        (if (erc-server-reconnect-p event)
+            (condition-case err
+                (progn
+                  (erc-server-reconnect)
+                  (setq erc-server-reconnect-count 0))
+              (error (when (integerp erc-server-reconnect-attempts)
+                       (setq erc-server-reconnect-count
+                             (1+ erc-server-reconnect-count))
+                       (sit-for erc-server-reconnect-timeout)
+                       (setq again t))))
+          ;; terminate, do not reconnect
+          (erc-display-message nil 'error (current-buffer)
+                               'terminated ?e event))))))
 
 (defun erc-process-sentinel (cproc event)
   "Sentinel function for ERC process."
@@ -1708,6 +1763,14 @@
                        ?c (second (erc-response.command-args parsed))
                        ?m (erc-response.contents parsed)))
 
+(define-erc-response-handler (465)
+  "You are banned from this server." nil
+  (setq erc-server-banned t)
+  ;; show the server's message, as a reason might be provided
+  (erc-display-error-notice
+   parsed
+   (erc-response.contents parsed)))
+
 (define-erc-response-handler (474)
   "Banned from channel errors" nil
   (erc-display-message parsed '(notice error) nil
@@ -1741,7 +1804,7 @@
     (erc-display-message parsed '(error notice) 'active 's482
                          ?c channel ?m message)))
 
-(define-erc-response-handler (431 445 446 451 462 463 464 465 481 483 484 485
+(define-erc-response-handler (431 445 446 451 462 463 464 481 483 484 485
                                   491 501 502)
   ;; 431 - No nickname given
   ;; 445 - SUMMON has been disabled
@@ -1750,7 +1813,6 @@
   ;; 462 - Unauthorized command (already registered)
   ;; 463 - Your host isn't among the privileged
   ;; 464 - Password incorrect
-  ;; 465 - You are banned from this server
   ;; 481 - Need IRCop privileges
   ;; 483 - You can't kill a server!
   ;; 484 - Your connection is restricted!
--- a/lisp/erc/erc-networks.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/erc/erc-networks.el	Sat Jan 06 15:25:16 2007 +0000
@@ -64,6 +64,7 @@
   ("AngelEyez: Random server" AngelEyez "irc.angeleyez.net" ((6666 7000)))
   ("AnotherNet: Random server" Anothernet "irc.another.net" (6667 7000 ))
   ("ArabChat: Random server" ArabChat "irc.arabchat.org" ((6660 6667)))
+  ("Ars-OpenIRC: Random server" Ars "irc.arstechnica.com" 6667)
   ("AsiaTalk: Random server" AsiaTalk "irc.asiatalk.org" ((6667 6669) 7000 ))
   ("AstroLink: Random server" AstroLink "irc.astrolink.org" ((6660 6667)))
   ("Asylumnet: Random server" Asylumnet "irc.asylum-net.org" ((6661 6669) 7000 7777 ))
@@ -280,12 +281,12 @@
   ("K0wNet: Random server" K0wNet "irc.k0w.net" ((6660 6669)))
   ("KDFSnet: Random server" KDFSnet "irc.kdfs.net" ((6667 6669)))
   ("Kemik: Random server" Kemik "irc.kemik.net" 6667)
-  ("Kewl.Org: Random server" Kewl.Org "irc.kewl.org" (6667 7000 ))
+  ("Kewl.Org: Random server" Kewl\.Org "irc.kewl.org" (6667 7000 ))
   ("Kickchat: Random server" Kickchat "irc.kickchat.com" ((6660 6669) 7000 ))
   ("Kidsworld: Random server" KidsWorld "irc.kidsworld.org" ((6666 6669)))
   ("Knightnet: AF, ZA, Durban" Knightnet "orc.dbn.za.knightnet.net" (6667 5555 ))
   ("Knightnet: US, CA, Goldengate" Knightnet "goldengate.ca.us.knightnet.net" (6667 5555 ))
-  ("Konfido.Net: Random server" Konfido.Net "irc.konfido.net" 6667)
+  ("Konfido.Net: Random server" Konfido\.Net "irc.konfido.net" 6667)
   ("KreyNet: Random server" Kreynet "irc.krey.net" 6667)
   ("Krono: Random server" Krono "irc.krono.net" ((6660 6669) 7000 ))
   ("Krushnet: Random server" Krushnet "irc.krushnet.org" 6667)
@@ -294,6 +295,7 @@
   ("LagNet: AF, ZA, Johannesburg" LagNet "mystery.lagnet.org.za" 6667)
   ("Librenet: Random server" Librenet "irc.librenet.net" 6667)
   ("LinkNet: Random server" LinkNet "irc.link-net.org" ((6667 6669)))
+  ("LinuxChix: Random server" LinuxChix "irc.linuxchix.org" 6667)
   ("Liquidized: Random server" Liquidized "irc.liquidized.net" (6667 7000 ))
   ("M-IRC: Random server" M-IRC "irc.m-sys.org" ((6667 6669)))
   ("MagicStar: Random server" MagicStar "irc.magicstar.net" 6667)
@@ -457,6 +459,7 @@
     (AngelEyez "angeleyez.net")
     (Anothernet "another.net")
     (ArabChat "arabchat.org")
+    (Ars "arstechnica.com")
     (AsiaTalk "asiatalk.org")
     (AstroLink "astrolink.org")
     (Asylumnet "asylumnet.org")
@@ -586,6 +589,7 @@
     (LagNet "lagnet.org.za")
     (Librenet "librenet.net")
     (LinkNet "link-net.org")
+    (LinuxChix "cats\.meow\.at\\|linuxchix\.org")
     (Liquidized "liquidized.net")
     (M-IRC "m-sys.org")
     (MagicStar "magicstar.net")
--- a/lisp/erc/erc-services.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/erc/erc-services.el	Sat Jan 06 15:25:16 2007 +0000
@@ -94,7 +94,7 @@
   (interactive
    (list (intern (completing-read
 		  "Choose Nickserv identify mode (RET to disable): "
-		  '(("autodetect") ("nick-change")) nil t))))
+		  '(("autodetect") ("nick-change") ("both")) nil t))))
   (cond ((eq mode 'autodetect)
 	 (setq erc-nickserv-identify-mode 'autodetect)
 	 (add-hook 'erc-server-NOTICE-functions
@@ -111,6 +111,14 @@
 		   'erc-nickserv-identify-on-nick-change)
 	 (remove-hook 'erc-server-NOTICE-functions
 		      'erc-nickserv-identify-autodetect))
+	((eq mode 'both)
+	 (setq erc-nickserv-identify-mode 'both)
+	 (add-hook 'erc-server-NOTICE-functions
+		   'erc-nickserv-identify-autodetect)
+	 (add-hook 'erc-after-connect
+		   'erc-nickserv-identify-on-connect)
+	 (add-hook 'erc-nick-changed-functions
+		   'erc-nickserv-identify-on-nick-change))
 	(t
 	 (setq erc-nickserv-identify-mode nil)
 	 (remove-hook 'erc-server-NOTICE-functions
@@ -120,22 +128,25 @@
 	 (remove-hook 'erc-nick-changed-functions
 		      'erc-nickserv-identify-on-nick-change))))
 
-(defcustom erc-nickserv-identify-mode 'autodetect
+(defcustom erc-nickserv-identify-mode 'both
   "The mode which is used when identifying to Nickserv.
 
 Possible settings are:.
 
 'autodetect  - Identify when the real Nickserv sends an identify request.
 'nick-change - Identify when you change your nickname.
+'both        - Do the former if the network supports it, otherwise do the
+               latter.
 nil          - Disables automatic Nickserv identification.
 
 You can also use M-x erc-nickserv-identify-mode to change modes."
   :group 'erc-services
   :type '(choice (const autodetect)
 		 (const nick-change)
+		 (const both)
 		 (const nil))
   :set (lambda (sym val)
-	 (set-default sym val)
+	 (set sym val)
 	 (erc-nickserv-identify-mode val)))
 
 (defcustom erc-prompt-for-nickserv-password t
@@ -156,12 +167,14 @@
 	  (list :tag "Network"
 		(choice :tag "Network name"
 			(const freenode)
+			(const OFTC)
 			(const DALnet)
 			(const GalaxyNet)
 			(const SlashNET)
 			(const BRASnet)
 			(const iip)
 			(const Austnet)
+			(const Azzurra)
 			(symbol :tag "Network name"))
 		(repeat :tag "Nickname and password"
 			(cons :tag "Identity"
@@ -209,24 +222,24 @@
      "IDENTIFY"
      nil
      "")
-     (Austnet
-      "NickOP!service@austnet.org"
-      "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>"
-      "nickop@austnet.org"
-      "identify"
-      nil)
-     (Azzurra
-      "NickServ!service@azzurra.org"
-      "/ns\\s-IDENTIFY\\s-password"
-      "NickServ"
-      "IDENTIFY"
-      nil)
-     (OFTC
-      "NickServ!services@services.oftc.net"
-      "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
-      "NickServ"
-      "IDENTIFY"
-      nil))
+    (Austnet
+     "NickOP!service@austnet.org"
+     "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>"
+     "nickop@austnet.org"
+     "identify"
+     nil)
+    (Azzurra
+     "NickServ!service@azzurra.org"
+     "/ns\\s-IDENTIFY\\s-password"
+     "NickServ"
+     "IDENTIFY"
+     nil)
+    (OFTC
+     "NickServ!services@services.oftc.net"
+     "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
+     "NickServ"
+     "IDENTIFY"
+     nil))
    "Alist of NickServer details, sorted by network.
 Every element in the list has the form
   \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER)
@@ -279,14 +292,18 @@
 
 (defun erc-nickserv-identify-on-connect (server nick)
   "Identify to Nickserv after the connection to the server is established."
-  (unless (and (null erc-nickserv-passwords)
-	       (null erc-prompt-for-nickserv-password))
+  (unless (or (and (null erc-nickserv-passwords)
+		   (null erc-prompt-for-nickserv-password))
+	      (and (eq erc-nickserv-identify-mode 'both)
+		   (nth 2 (assoc (erc-network) erc-nickserv-alist))))
     (erc-nickserv-call-identify-function nick)))
 
 (defun erc-nickserv-identify-on-nick-change (nick old-nick)
   "Identify to Nickserv whenever your nick changes."
-  (unless (and (null erc-nickserv-passwords)
-	       (null erc-prompt-for-nickserv-password))
+  (unless (or (and (null erc-nickserv-passwords)
+		   (null erc-prompt-for-nickserv-password))
+	      (and (eq erc-nickserv-identify-mode 'both)
+		   (nth 2 (assoc (erc-network) erc-nickserv-alist))))
     (erc-nickserv-call-identify-function nick)))
 
 (defun erc-nickserv-call-identify-function (nickname)
--- a/lisp/erc/erc.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/erc/erc.el	Sat Jan 06 15:25:16 2007 +0000
@@ -1672,21 +1672,22 @@
     (require 'iswitchb))
   (let ((enabled iswitchb-mode))
     (or enabled (iswitchb-mode 1))
-    (let ((iswitchb-make-buflist-hook
-	   (lambda ()
-	     (setq iswitchb-temp-buflist
-		   (mapcar 'buffer-name
-			   (erc-buffer-list
-			    nil
-			    (when arg erc-server-process)))))))
-      (switch-to-buffer
-       (iswitchb-read-buffer
-	"Switch-to: "
-	(if (boundp 'erc-modified-channels-alist)
-	    (buffer-name (caar (last erc-modified-channels-alist)))
-	  nil)
-	t)))
-    (or enabled (iswitchb-mode -1))))
+    (unwind-protect
+	(let ((iswitchb-make-buflist-hook
+	       (lambda ()
+		 (setq iswitchb-temp-buflist
+		       (mapcar 'buffer-name
+			       (erc-buffer-list
+				nil
+				(when arg erc-server-process)))))))
+	  (switch-to-buffer
+	   (iswitchb-read-buffer
+	    "Switch-to: "
+	    (if (boundp 'erc-modified-channels-alist)
+		(buffer-name (caar (last erc-modified-channels-alist)))
+	      nil)
+	    t)))
+      (or enabled (iswitchb-mode -1)))))
 
 (defun erc-channel-list (proc)
   "Return a list of channel buffers.
@@ -1888,10 +1889,11 @@
 	(connected-p (unless connect erc-server-connected))
 	(buffer (erc-get-buffer-create server port channel))
 	(old-buffer (current-buffer))
-	(old-point (point))
+	old-point
 	continued-session)
     (erc-update-modules)
     (set-buffer buffer)
+    (setq old-point (point))
     (erc-mode)
     (setq erc-server-announced-name server-announced-name)
     (setq erc-server-connected connected-p)
@@ -3165,6 +3167,12 @@
 (defalias 'erc-cmd-GQ 'erc-cmd-GQUIT)
 (put 'erc-cmd-GQUIT 'do-not-parse-args t)
 
+(defun erc-cmd-RECONNECT ()
+  "Try to reconnect to the current IRC server."
+  (setq erc-server-reconnect-count 0)
+  (erc-server-reconnect)
+  t)
+
 (defun erc-cmd-SERVER (server)
   "Connect to SERVER, leaving existing connection intact."
   (erc-log (format "cmd: SERVER: %s" server))
--- a/lisp/faces.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/faces.el	Sat Jan 06 15:25:16 2007 +0000
@@ -2179,6 +2179,11 @@
   :version "21.1"
   :group 'basic-faces)
 
+(defface momentary
+  '((t (:inherit mode-line)))
+  "Face for momentarily displaying text in the current buffer."
+  :group 'display)
+
 (defface vertical-border
   '((((type tty)) :inherit mode-line-inactive))
   "Face used for vertical window dividers on ttys."
--- a/lisp/files.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/files.el	Sat Jan 06 15:25:16 2007 +0000
@@ -242,9 +242,9 @@
 
 (defcustom version-control nil
   "Control use of version numbers for backup files.
-t means make numeric backup versions unconditionally.
-nil means make them for files that have some already.
-`never' means do not make them."
+When t, make numeric backup versions unconditionally.
+When nil, make them for files that have some already.
+The value `never' means do not make them."
   :type '(choice (const :tag "Never" never)
 		 (const :tag "If existing" nil)
 		 (other :tag "Always" t))
@@ -1650,7 +1650,8 @@
       (setq default-directory (file-name-directory buffer-file-name))
       ;; Turn off backup files for certain file names.  Since
       ;; this is a permanent local, the major mode won't eliminate it.
-      (and (not (funcall backup-enable-predicate buffer-file-name))
+      (and backup-enable-predicate
+	   (not (funcall backup-enable-predicate buffer-file-name))
 	   (progn
 	     (make-local-variable 'backup-inhibited)
 	     (setq backup-inhibited t)))
@@ -2905,6 +2906,7 @@
   ;; Turn off backup files for certain file names.
   ;; Since this is a permanent local, the major mode won't eliminate it.
   (and buffer-file-name
+       backup-enable-predicate
        (not (funcall backup-enable-predicate buffer-file-name))
        (progn
 	 (make-local-variable 'backup-inhibited)
--- a/lisp/gnus/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/gnus/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,8 @@
+2007-01-05  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus-soup.el (gnus-soup): New custom group.  Make user variables
+	customizable.
+
 2006-12-30  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>
 
 	* gnus-sum.el (gnus-summary-insert-dormant-articles): Fix typo in
--- a/lisp/gnus/gnus-soup.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/gnus/gnus-soup.el	Sat Jan 06 15:25:16 2007 +0000
@@ -36,36 +36,56 @@
 (require 'gnus-start)
 (require 'gnus-range)
 
+(defgroup gnus-soup nil
+  "SOUP packet writing support for Gnus."
+  :group 'gnus)
+
 ;;; User Variables:
 
-(defvar gnus-soup-directory (nnheader-concat gnus-home-directory "SoupBrew/")
-  "*Directory containing an unpacked SOUP packet.")
+(defcustom gnus-soup-directory (nnheader-concat gnus-home-directory "SoupBrew/")
+  "Directory containing an unpacked SOUP packet."
+  :version "22.1" ;; Gnus 5.10.9
+  :type 'directory)
 
-(defvar gnus-soup-replies-directory
+(defcustom gnus-soup-replies-directory
   (nnheader-concat gnus-soup-directory "SoupReplies/")
-  "*Directory where Gnus will do processing of replies.")
+  "Directory where Gnus will do processing of replies."
+  :version "22.1" ;; Gnus 5.10.9
+  :type 'directory)
 
-(defvar gnus-soup-prefix-file "gnus-prefix"
-  "*Name of the file where Gnus stores the last used prefix.")
+(defcustom gnus-soup-prefix-file "gnus-prefix"
+  "Name of the file where Gnus stores the last used prefix."
+  :version "22.1" ;; Gnus 5.10.9
+  :type 'file)
 
-(defvar gnus-soup-packer "tar cf - %s | gzip > $HOME/Soupout%d.tgz"
+(defcustom gnus-soup-packer "tar cf - %s | gzip > $HOME/Soupout%d.tgz"
   "Format string command for packing a SOUP packet.
 The SOUP files will be inserted where the %s is in the string.
 This string MUST contain both %s and %d.  The file number will be
-inserted where %d appears.")
+inserted where %d appears."
+  :version "22.1" ;; Gnus 5.10.9
+  :type 'string)
 
-(defvar gnus-soup-unpacker "gunzip -c %s | tar xvf -"
-  "*Format string command for unpacking a SOUP packet.
-The SOUP packet file name will be inserted at the %s.")
+(defcustom gnus-soup-unpacker "gunzip -c %s | tar xvf -"
+  "Format string command for unpacking a SOUP packet.
+The SOUP packet file name will be inserted at the %s."
+  :version "22.1" ;; Gnus 5.10.9
+  :type 'string)
 
-(defvar gnus-soup-packet-directory gnus-home-directory
-  "*Where gnus-soup will look for REPLIES packets.")
+(defcustom gnus-soup-packet-directory gnus-home-directory
+  "Where gnus-soup will look for REPLIES packets."
+  :version "22.1" ;; Gnus 5.10.9
+  :type 'directory)
 
-(defvar gnus-soup-packet-regexp "Soupin"
-  "*Regular expression matching SOUP REPLIES packets in `gnus-soup-packet-directory'.")
+(defcustom gnus-soup-packet-regexp "Soupin"
+  "Regular expression matching SOUP REPLIES packets in `gnus-soup-packet-directory'."
+  :version "22.1" ;; Gnus 5.10.9
+  :type 'regexp)
 
-(defvar gnus-soup-ignored-headers "^Xref:"
-  "*Regexp to match headers to be removed when brewing SOUP packets.")
+(defcustom gnus-soup-ignored-headers "^Xref:"
+  "Regexp to match headers to be removed when brewing SOUP packets."
+  :version "22.1" ;; Gnus 5.10.9
+  :type 'regexp)
 
 ;;; Internal Variables:
 
--- a/lisp/image.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/image.el	Sat Jan 06 15:25:16 2007 +0000
@@ -38,7 +38,9 @@
     ("\\`P[1-6][[:space:]]+\\(?:#.*[[:space:]]+\\)*[0-9]+[[:space:]]+[0-9]+" . pbm)
     ("\\`GIF8" . gif)
     ("\\`\x89PNG\r\n\x1a\n" . png)
-    ("\\`[\t\n\r ]*#define" . xbm)
+    ("\\`[\t\n\r ]*#define \\([a-z0-9]+\\)_width [0-9]+\n\
+#define \\1_height [0-9]+\n\
+static char \\1_bits" . xbm)
     ("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . tiff)
     ("\\`[\t\n\r ]*%!PS" . postscript)
     ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))
--- a/lisp/international/mule.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/international/mule.el	Sat Jan 06 15:25:16 2007 +0000
@@ -2299,7 +2299,12 @@
 			;; In case of no header, search only 10 lines.
 			(forward-line 10))
 		    (point))))
-  (when (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t)
+  ;; Make sure that the buffer really contains an HTML document, by
+  ;; checking that it starts with a doctype or a <HTML> start tag
+  ;; (allowing for whitespace at bob).  Note: 'DOCTYPE NETSCAPE' is
+  ;; useful for Mozilla bookmark files.
+  (when (and (re-search-forward "\\`[[:space:]\n]*\\(<!doctype[[:space:]\n]+\\(html\\|netscape\\)\\|<html\\)" size t)
+	     (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t))
     (let* ((match (match-string 1))
 	   (sym (intern (downcase match))))
       (if (coding-system-p sym)
--- a/lisp/isearch.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/isearch.el	Sat Jan 06 15:25:16 2007 +0000
@@ -784,13 +784,15 @@
   (lazy-highlight-cleanup lazy-highlight-cleanup)
   (let ((found-start (window-start (selected-window)))
 	(found-point (point)))
-    (if isearch-window-configuration
-	(set-window-configuration isearch-window-configuration))
-
-    (if isearch-small-window
-	(goto-char found-point)
-      ;; Exiting the save-window-excursion clobbers window-start; restore it.
-      (set-window-start (selected-window) found-start t)))
+    (when isearch-window-configuration
+      (set-window-configuration isearch-window-configuration)
+      (if isearch-small-window
+	  (goto-char found-point)
+	;; set-window-configuration clobbers window-start; restore it.
+	;; This has an annoying side effect of clearing the last_modiff
+	;; field of the window, which can cause unwanted scrolling,
+	;; so don't do it unless truly necessary.
+	(set-window-start (selected-window) found-start t))))
 
   (setq isearch-mode nil)
   (if isearch-input-method-local-p
--- a/lisp/iswitchb.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/iswitchb.el	Sat Jan 06 15:25:16 2007 +0000
@@ -1,7 +1,7 @@
 ;;; iswitchb.el --- switch between buffers using substrings
 
 ;; Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006 Free Software Foundation, Inc.
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Stephen Eglen <stephen@gnu.org>
 ;; Maintainer: Stephen Eglen <stephen@gnu.org>
@@ -495,14 +495,13 @@
 
 (defvar iswitchb-global-map
   (let ((map (make-sparse-keymap)))
-    (substitute-key-definition 'switch-to-buffer ; normally C-x b
-			       'iswitchb-buffer map global-map)
-    (substitute-key-definition 'switch-to-buffer-other-window ; C-x 4 b
-			       'iswitchb-buffer-other-window map global-map)
-    (substitute-key-definition 'switch-to-buffer-other-frame ; C-x 5 b
-			       'iswitchb-buffer-other-frame map global-map)
-    (substitute-key-definition 'display-buffer ; C-x 4 C-o
-			       'iswitchb-display-buffer map global-map)
+    (dolist (b '((switch-to-buffer . iswitchb-buffer)
+                 (switch-to-buffer-other-window . iswitchb-buffer-other-window)
+                 (switch-to-buffer-other-frame . iswitchb-buffer-other-frame)
+                 (display-buffer . iswitchb-display-buffer)))
+      (if (fboundp 'command-remapping)
+          (define-key map (vector 'remap (car b)) (cdr b))
+        (substitute-key-definition (car b) (cdr b) map global-map)))
     map)
   "Global keymap for `iswitchb-mode'.")
 
--- a/lisp/progmodes/cc-align.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-align.el	Sat Jan 06 15:25:16 2007 +0000
@@ -90,6 +90,29 @@
 		       (c-after-special-operator-id))))
 	c-basic-offset)))
 
+(defun c-lineup-gnu-DEFUN-intro-cont (langelem)
+  "Line up the continuation lines of a DEFUN macro in the Emacs C source.
+These lines are indented as though they were `knr-argdecl-intro' lines.
+Return nil when we're not in such a construct.
+
+This function is for historical compatibility with how previous CC Modes (5.28
+and earlier) indented such lines.
+
+Here is an example:
+
+DEFUN (\"forward-char\", Fforward_char, Sforward_char, 0, 1, \"p\",
+       doc: /* Move point right N characters (left if N is negative).
+On reaching end of buffer, stop and signal error.  */)
+     (n)                      <- c-lineup-gnu-DEFUN-into-cont
+     Lisp_Object n;           <- c-lineup-gnu-DEFUN-into-cont
+
+Works with: topmost-intro-cont."
+  (save-excursion
+    (let (case-fold-search)
+      (goto-char (c-langelem-pos langelem))
+      (if (looking-at "\\<DEFUN\\>")
+	  (c-calc-offset '(knr-argdecl-intro))))))
+
 (defun c-block-in-arglist-dwim (arglist-start)
   ;; This function implements the DWIM to avoid far indentation of
   ;; brace block constructs in arguments in `c-lineup-arglist' etc.
--- a/lisp/progmodes/cc-awk.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-awk.el	Sat Jan 06 15:25:16 2007 +0000
@@ -720,7 +720,7 @@
             (not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t))
           (search-forward-regexp c-awk-div-sign-re (1+ /point) t))
         ;; A division sign.
-      (progn (goto-char (1+ /point)) nil)
+	(progn (goto-char (1+ /point)) nil)
       ;; A regexp opener
       ;; Jump over the regexp innards, setting the match data.
       (goto-char /point)
--- a/lisp/progmodes/cc-cmds.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-cmds.el	Sat Jan 06 15:25:16 2007 +0000
@@ -53,6 +53,7 @@
 (cc-bytecomp-defun c-forward-subword)
 (cc-bytecomp-defun c-backward-subword)
 
+;; Indentation / Display syntax functions
 (defvar c-fix-backslashes t)
 
 (defun c-indent-line (&optional syntax quiet ignore-point-pos)
@@ -252,6 +253,7 @@
 	(forward-line)))))
 
 
+;; Minor mode functions.
 (defun c-update-modeline ()
   (let ((fmt (format "/%s%s%s%s"
 		     (if c-electric-flag "l" "")
@@ -843,13 +845,17 @@
 	       (eq literal 'c)
 	       (memq 'comment-close-slash c-cleanup-list)
 	       (eq last-command-char ?/)
+	       (looking-at (concat "[ \t]*\\("
+				   (regexp-quote comment-end) "\\)?$"))
 	; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */
 	       (save-excursion
-		 (back-to-indentation)
-		 (looking-at (concat c-current-comment-prefix "[ \t]*$"))))
-      (end-of-line)
-      (delete-horizontal-space)
-      (or (eq (char-before) ?*) (insert-char ?* 1))) ; Do I need a t (retain sticky properties) here?
+		 (save-restriction
+		   (narrow-to-region (point-min) (point))
+		   (back-to-indentation)
+		   (looking-at (concat c-current-comment-prefix "[ \t]*$")))))
+      (kill-region (progn (forward-line 0) (point))
+		   (progn (end-of-line) (point)))
+      (insert-char ?* 1)) ; the / comes later. ; Do I need a t (retain sticky properties) here?
 
     (setq indentp (and (not arg)
 		       c-syntactic-indentation
@@ -1253,7 +1259,11 @@
 		     (backward-char)
 		     (skip-chars-backward " \t")
 		     (setq beg (point))
-		     (c-save-buffer-state () (c-on-identifier))))
+		     (c-save-buffer-state () (c-on-identifier))
+		     ;; Don't add a space into #define FOO()....
+		     (not (and (c-beginning-of-macro)
+			       (c-forward-over-cpp-define-id)
+			       (eq (point) beg)))))
 	      (save-excursion
 		(delete-region beg end)
 		(goto-char beg)
@@ -1308,6 +1318,7 @@
 	(delete-char -2)))))
 
 
+;; "nomenclature" functions + c-scope-operator.
 (defun c-forward-into-nomenclature (&optional arg)
   "Compatibility alias for `c-forward-subword'."
   (interactive "p")
@@ -1328,6 +1339,160 @@
   (interactive "*")
   (insert-and-inherit "::"))
 
+
+;; Movement (etc.) by defuns.
+(defun c-in-function-trailer-p (&optional lim)
+  ;; Return non-nil if point is between the closing brace and the semicolon of
+  ;; a brace construct which needs a semicolon, e.g. within the "variables"
+  ;; portion of a declaration like "struct foo {...} bar ;".
+  ;;
+  ;; Return the position of the main declaration.  Otherwise, return nil.
+  ;; Point is assumed to be at the top level and outside of any macro or
+  ;; literal.
+  ;;
+  ;; If LIM is non-nil, it is the bound on a the backward search for the
+  ;; beginning of the declaration.
+  ;;
+  ;; This function might do hidden buffer changes.
+  (and c-opt-block-decls-with-vars-key
+       (save-excursion
+	 (c-syntactic-skip-backward "^;}" lim)
+	 (and (eq (char-before) ?\})
+	      (eq (car (c-beginning-of-decl-1 lim)) 'previous)
+	      (looking-at c-opt-block-decls-with-vars-key)
+	      (point)))))
+
+(defun c-where-wrt-brace-construct ()
+  ;; Determine where we are with respect to functions (or other brace
+  ;; constructs, included in the term "function" in the rest of this comment).
+  ;; Point is assumed to be outside any macro or literal.
+  ;; This is used by c-\(begining\|end\)-of-defun.
+  ;;
+  ;; Return one of these symbols:
+  ;; at-header       : we're at the start of a function's header.
+  ;; in-header       : we're inside a function's header, this extending right
+  ;;                   up to the brace.  This bit includes any k&r declarations.
+  ;; in-block        : we're inside a function's brace block.
+  ;; in-trailer      : we're in the area between the "}" and ";" of something
+  ;;                  like "struct foo {...} bar, baz;".
+  ;; at-function-end : we're just after the closing brace (or semicolon) that
+  ;;                   terminates the function.
+  ;; outwith-function: we're not at or in any function.  Being inside a
+  ;;                   non-brace construct also counts as 'outwith-function'.
+  ;;
+  ;; This function might do hidden buffer changes.
+  (save-excursion
+    (let* (pos
+	   kluge-start
+	   decl-result brace-decl-p
+	   (start (point))
+	   (paren-state (c-parse-state))
+	   (least-enclosing (c-least-enclosing-brace paren-state)))
+
+      (cond
+       ((and least-enclosing
+	     (eq (char-after least-enclosing) ?\{))
+	'in-block)
+       ((c-in-function-trailer-p)
+	'in-trailer)
+       ((and (not least-enclosing)
+	     (consp paren-state)
+	     (consp (car paren-state))
+	     (eq start (cdar paren-state)))
+	'at-function-end)
+       (t
+	;; Find the start of the current declaration.  NOTE: If we're in the
+	;; variables after a "struct/eval" type block, we don't get to the
+	;; real declaration here - we detect and correct for this later.
+
+	;;If we're in the parameters' parens, move back out of them.
+	(if least-enclosing (goto-char least-enclosing))
+	;; Kluge so that c-beginning-of-decl-1 won't go back if we're already
+	;; at a declaration.
+	(if (or (and (eolp) (not (eobp))) ; EOL is matched by "\\s>"
+		(not (looking-at
+"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)")))
+	    (forward-char))
+	(setq kluge-start (point))
+	(setq decl-result
+	      (car (c-beginning-of-decl-1
+		    (and least-enclosing ; LIMIT for c-b-of-decl-1
+			 (c-safe-position least-enclosing paren-state)))))
+
+	;; Has the declaration we've gone back to got braces?
+	(setq pos (point))	      ; the search limit for c-recognize-knr-p
+	(setq brace-decl-p
+	      (save-excursion
+		    (and (c-syntactic-re-search-forward "[;{]" nil t t)
+			 (or (eq (char-before) ?\{)
+			     (and c-recognize-knr-p
+				  ;; Might have stopped on the
+				  ;; ';' in a K&R argdecl.  In
+				  ;; that case the declaration
+				  ;; should contain a block.
+				  (c-in-knr-argdecl pos))))))
+
+	(cond
+	 ((= (point) kluge-start)	; might be BOB or unbalanced parens.
+	  'outwith-function)
+	 ((eq decl-result 'same)
+	  (if brace-decl-p
+	      (if (eq (point) start)
+		  'at-header
+		'in-header)
+	    'outwith-function))
+	 ((eq decl-result 'previous)
+	  (if (and (not brace-decl-p)
+		   (c-in-function-trailer-p))
+	      'at-function-end
+	    'outwith-function))
+	 (t (error
+	     "c-where-wrt-brace-construct: c-beginning-of-decl-1 returned %s"
+	     decl-result))))))))
+
+(defun c-backward-to-nth-BOF-{ (n where)
+  ;; Skip to the opening brace of the Nth function before point.  If
+  ;; point is inside a function, this counts as the first.  Point must be
+  ;; outside any comment/string or macro.
+  ;;
+  ;; N must be strictly positive.
+  ;; WHERE describes the position of point, one of the symbols `at-header',
+  ;; `in-header', `in-block', `in-trailer', `at-function-end',
+  ;; `outwith-function' as returned by c-where-wrt-brace-construct.
+  ;;
+  ;; If we run out of functions, leave point at BOB.  Return zero on success,
+  ;; otherwise the number of {s still to go.
+  ;;
+  ;; This function may do hidden buffer changes
+  (cond
+   ;; What we do to go back the first defun depends on where we start.
+   ((bobp))
+   ((eq where 'in-block)
+    (goto-char (c-least-enclosing-brace (c-parse-state)))
+    (setq n (1- n)))
+   ((eq where 'in-header)
+    (c-syntactic-re-search-forward "{")
+    (backward-char)
+    (setq n (1- n)))
+   (;; (or (eq where 'at-header) (eq where 'outwith-function)
+;; 	(eq where 'at-function-end) (eq where 'in-trailer))
+    (memq where '(at-header outwith-function at-function-end in-trailer))
+    (c-syntactic-skip-backward "^}")
+    (when (eq (char-before) ?\})
+      (backward-sexp)
+      (setq n (1- n))))
+   (t (error "Unknown `where' %s in c-backward-to-nth-EOF-{" where)))
+
+   ;; Each time round the loop, go back to a "{" at the outermost level.
+  (while (and (> n 0) (not (bobp)))
+    (c-parse-state)		       ; This call speeds up the following one
+					; by a factor of ~6.  Hmmm.  2006/4/5.
+    (c-syntactic-skip-backward "^}")
+    (when (eq (char-before) ?\})
+      (backward-sexp)
+      (setq n (1- n))))
+   n)
+
 (defun c-beginning-of-defun (&optional arg)
   "Move backward to the beginning of a defun.
 Every top level declaration that contains a brace paren block is
@@ -1344,88 +1509,99 @@
   (interactive "p")
   (or arg (setq arg 1))
 
-  (if (< arg 0)
-      (when (c-end-of-defun (- arg))
-	(c-save-buffer-state nil (c-forward-syntactic-ws))
-	t)
-
-    (c-save-buffer-state (paren-state lim pos)
-      (catch 'exit
-	(while (> arg 0)
-	  ;; Note: Partial code duplication in `c-end-of-defun' and
-	  ;; `c-declaration-limits'.
-
-	  (setq paren-state (c-parse-state))
-	  (unless (c-safe
-		    (goto-char (c-least-enclosing-brace paren-state))
-		    ;; If we moved to the outermost enclosing paren
-		    ;; then we can use c-safe-position to set the
-		    ;; limit.  Can't do that otherwise since the
-		    ;; earlier paren pair on paren-state might very
-		    ;; well be part of the declaration we should go
-		    ;; to.
-		    (setq lim (c-safe-position (point) paren-state))
-		    t)
-	    ;; At top level.  Make sure we aren't inside a literal.
-	    (setq pos (c-literal-limits
-		       (c-safe-position (point) paren-state)))
-	    (if pos (goto-char (car pos))))
-
-	  (while (let ((start (point)))
-		   (c-beginning-of-decl-1 lim)
-		   (if (= (point) start)
-		       ;; Didn't move.  Might be due to bob or unbalanced
-		       ;; parens.  Try to continue if it's the latter.
-		       (unless (c-safe (goto-char
-					(c-down-list-backward (point))))
-			 ;; Didn't work, so it's bob then.
-			 (goto-char (point-min))
-			 (throw 'exit nil)))
-
-		   (save-excursion
-		     ;; Check if the declaration contains a brace
-		     ;; block.  If not, we try another one.
-		     (setq pos (point))
-		     (not (and (c-syntactic-re-search-forward "[;{]" nil t t)
-			       (or (eq (char-before) ?{)
-				   (and c-recognize-knr-p
-					;; Might have stopped on the
-					;; ';' in a K&R argdecl.  In
-					;; that case the declaration
-					;; should contain a block.
-					(c-in-knr-argdecl pos)))))))
-	    (setq lim nil))
-
-	  ;; Check if `c-beginning-of-decl-1' put us after the block
-	  ;; in a declaration that doesn't end there.  We're searching
-	  ;; back and forth over the block here, which can be
-	  ;; expensive.
-	  (setq pos (point))
-	  (if (and c-opt-block-decls-with-vars-key
-		   (progn
-		     (c-backward-syntactic-ws)
-		     (eq (char-before) ?}))
-		   (eq (car (c-beginning-of-decl-1))
-		       'previous)
-		   (save-excursion
-		     (c-end-of-decl-1)
-		     (> (point) pos)))
-	      nil
-	    (goto-char pos))
-
-	  (setq pos (point))
-	  ;; Try to be line oriented; position point at the closest
-	  ;; preceding boi that isn't inside a comment, but if we hit
-	  ;; the previous declaration then we use the current point
-	  ;; instead.
-	  (while (and (/= (point) (c-point 'boi))
-		      (c-backward-single-comment)))
-	  (if (/= (point) (c-point 'boi))
-	      (goto-char pos))
-
-	  (setq arg (1- arg)))))
-    (c-keep-region-active)
-    (= arg 0)))
+  (c-save-buffer-state
+      ((start (point))
+       where paren-state pos)
+
+    ;; Move back out of any macro/comment/string we happen to be in.
+    (c-beginning-of-macro)
+    (setq pos (c-literal-limits))
+    (if pos (goto-char (car pos)))
+
+    (setq where (c-where-wrt-brace-construct))
+
+    (if (< arg 0)
+	;; Move forward to the closing brace of a function.
+	(progn
+	  (if ;; (or (eq where 'at-function-end) (eq where 'outwith-function))
+	      (memq where '(at-function-end outwith-function))
+	      (setq arg (1+ arg)))
+	  (if (< arg 0)
+	      (setq arg (c-forward-to-nth-EOF-} (- arg) where)))
+	  ;; Move forward to the next opening brace....
+	  (when (and (= arg 0)
+		     (c-syntactic-re-search-forward "{" nil t))
+	    (backward-char)
+	    ;; ... and backward to the function header.
+	    (c-beginning-of-decl-1)
+	    t))
+
+      ;; Move backward to the opening brace of a function.
+      (when (and (> arg 0)
+		 (eq (setq arg (c-backward-to-nth-BOF-{ arg where)) 0))
+
+	;; Go backward to this function's header.
+	(c-beginning-of-decl-1)
+
+	(setq pos (point))
+	;; We're now there, modulo comments and whitespace.
+	;; Try to be line oriented; position point at the closest
+	;; preceding boi that isn't inside a comment, but if we hit
+	;; the previous declaration then we use the current point
+	;; instead.
+	(while (and (/= (point) (c-point 'boi))
+		    (c-backward-single-comment)))
+	(if (/= (point) (c-point 'boi))
+	    (goto-char pos)))
+
+      (c-keep-region-active)
+      (= arg 0))))
+
+(defun c-forward-to-nth-EOF-} (n where)
+  ;; Skip to the closing brace of the Nth function after point.  If
+  ;; point is inside a function, this counts as the first.  Point must be
+  ;; outside any comment/string or macro.
+  ;;
+  ;; N must be strictly positive.
+  ;; WHERE describes the position of point, one of the symbols `at-header',
+  ;; `in-header', `in-block', `in-trailer', `at-function-end',
+  ;; `outwith-function' as returned by c-where-wrt-brace-construct.
+  ;;
+  ;; If we run out of functions, leave point at EOB.  Return zero on success,
+  ;; otherwise the number of }s still to go.
+  ;;
+  ;; This function may do hidden buffer changes.
+
+  (cond
+  ;; What we do to go forward over the first defun depends on where we
+  ;; start.  We go to the closing brace of that defun, even when we go
+  ;; backwards to it (in a "struct foo {...} bar ;").
+   ((eobp))
+   ((eq where 'in-block)
+    (goto-char (c-least-enclosing-brace (c-parse-state)))
+    (forward-sexp)
+    (setq n (1- n)))
+   ((eq where 'in-trailer)
+    (c-syntactic-skip-backward "^}")
+    (setq n (1- n)))
+   (;; (or (eq where 'at-function-end) (eq where 'outwith-function)
+;; 	(eq where 'at-header) (eq where 'in-header))
+    (memq where '(at-function-end outwith-function at-header in-header))
+    (c-syntactic-re-search-forward "{")
+    (backward-char)
+    (forward-sexp)
+    (setq n (1- n)))
+   (t (error "c-forward-to-nth-EOF-}: `where' is %s" where)))
+
+  ;; Each time round the loop, go forward to a "}" at the outermost level.
+  (while (and (> n 0) (not (eobp)))
+					;(c-parse-state)	; This call speeds up the following one by a factor
+					; of ~6.  Hmmm.  2006/4/5.
+    (when (c-syntactic-re-search-forward "{" nil 'eob)
+      (backward-char)
+      (forward-sexp))
+    (setq n (1- n)))
+  n)
 
 (defun c-end-of-defun (&optional arg)
   "Move forward to the end of a top level declaration.
@@ -1435,82 +1611,56 @@
 
 An end of a defun occurs right after the close-parenthesis that matches
 the open-parenthesis that starts a defun; see `beginning-of-defun'."
-
   (interactive "p")
   (or arg (setq arg 1))
 
-  (if (< arg 0)
-      (when (c-beginning-of-defun (- arg))
-	(c-save-buffer-state nil (c-backward-syntactic-ws))
-	t)
-
-    (c-save-buffer-state (paren-state lim pos)
-      (catch 'exit
-	(while (> arg 0)
-	  ;; Note: Partial code duplication in `c-beginning-of-defun'
-	  ;; and `c-declaration-limits'.
-
-	  (setq paren-state (c-parse-state))
-	  (unless (c-safe
-		    (goto-char (c-least-enclosing-brace paren-state))
-		    ;; If we moved to the outermost enclosing paren
-		    ;; then we can use c-safe-position to set the
-		    ;; limit.  Can't do that otherwise since the
-		    ;; earlier paren pair on paren-state might very
-		    ;; well be part of the declaration we should go
-		    ;; to.
-		    (setq lim (c-safe-position (point) paren-state))
-		    t)
-	    ;; At top level.  Make sure we aren't inside a literal.
-	    (setq pos (car-safe (c-literal-limits
-				 (c-safe-position (point) paren-state))))
-	    (if pos (goto-char pos)))
-
-	  ;; Have to move to the start first so that `c-end-of-decl-1'
-	  ;; has the correct start position.
-	  (setq pos (point))
-	  (when (memq (car (c-beginning-of-decl-1 lim))
-		      '(previous macro))
-	    ;; We moved back over the previous defun or a macro.  Move
-	    ;; to the next token; it's the start of the next
-	    ;; declaration.  We can also be directly after the block
-	    ;; in a `c-opt-block-decls-with-vars-key' declaration, but
-	    ;; then we won't move significantly far here.
-	    (goto-char pos)
-	    (c-forward-token-2 0))
-
-	  (while (let ((start (point)))
-		   (c-end-of-decl-1)
-		   (if (= (point) start)
-		       ;; Didn't move.  Might be due to eob or unbalanced
-		       ;; parens.  Try to continue if it's the latter.
-		       (if (c-safe (goto-char (c-up-list-forward (point))))
-			   t
-			 ;; Didn't work, so it's eob then.
-			 (goto-char (point-max))
-			 (throw 'exit nil))
-
-		     (save-excursion
-		       ;; Check if the declaration contains a brace
-		       ;; block.  If not, we try another one.
-		       (setq pos (point))
-		       (goto-char start)
-		       (not (c-syntactic-re-search-forward "{" pos t t))))))
-
-	  (setq pos (point))
-	  ;; Try to be line oriented; position point after the next
-	  ;; newline that isn't inside a comment, but if we hit the
-	  ;; next declaration then we use the current point instead.
-	  (while (and (not (bolp))
-		      (not (looking-at "\\s *$"))
-		      (c-forward-single-comment)))
-	  (cond ((bolp))
-		((looking-at "\\s *$")
-		 (forward-line 1))
-		(t
-		 (goto-char pos)))
-
-	  (setq arg (1- arg)))))
+  (c-save-buffer-state
+      ((start (point))
+       where paren-state pos)
+
+    ;; Move back out of any macro/comment/string we happen to be in.
+    (c-beginning-of-macro)
+    (setq pos (c-literal-limits))
+    (if pos (goto-char (car pos)))
+
+    (setq where (c-where-wrt-brace-construct))
+
+    (if (< arg 0)
+	;; Move backwards to the } of a function
+	(progn
+	  (if ;; (or (eq where 'at-header) (eq where 'outwith-function))
+	      (memq where '(at-header outwith-function))
+	      (setq arg (1+ arg)))
+	  (if (< arg 0)
+	      (setq arg (c-backward-to-nth-BOF-{ (- arg) where)))
+	  (when (and (= arg 0)
+		     (c-syntactic-skip-backward "^}")
+		     (eq (char-before) ?\}))
+	    t))
+
+      ;; Move forward to the } of a function
+      (if (> arg 0)
+	  (setq arg (c-forward-to-nth-EOF-} arg where))))
+
+    ;; Do we need to move forward from the brace to the semicolon?
+    (when (eq arg 0)
+      (if (c-in-function-trailer-p)	; after "}" of struct/enum, etc.
+	  (c-syntactic-re-search-forward ";"))
+
+      (setq pos (point))
+      ;; We're there now, modulo comments and whitespace.
+      ;; Try to be line oriented; position point after the next
+      ;; newline that isn't inside a comment, but if we hit the
+      ;; next declaration then we use the current point instead.
+      (while (and (not (bolp))
+		  (not (looking-at "\\s *$"))
+		  (c-forward-single-comment)))
+      (cond ((bolp))
+	    ((looking-at "\\s *$")
+	     (forward-line 1))
+	    (t
+	     (goto-char pos))))
+
     (c-keep-region-active)
     (= arg 0)))
 
@@ -1646,6 +1796,7 @@
       (push-mark (cdr decl-limits) nil t))))
 
 
+;; Movement by statements.
 (defun c-in-comment-line-prefix-p ()
   ;; Point is within a comment.  Is it also within a comment-prefix?
   ;; Space at BOL which precedes a comment-prefix counts as part of it.
@@ -2429,7 +2580,6 @@
 	(if (/= count 0) (setq count (1- count))))
       (c-keep-region-active))))
 
-
 
 ;; set up electric character functions to work with pending-del,
 ;; (a.k.a. delsel) mode.  All symbols get the t value except
@@ -2455,6 +2605,7 @@
 (put 'c-electric-delete-forward 'pending-delete   'supersede) ; pending-del
 
 
+;; Inserting/indenting comments
 (defun c-calc-comment-indent (entry)
   ;; This function might do hidden buffer changes.
   (if (symbolp entry)
@@ -2550,6 +2701,7 @@
       (current-column))))
 
 
+;; Movement by CPP conditionals.
 (defun c-up-conditional (count)
   "Move back to the containing preprocessor conditional, leaving mark behind.
 A prefix argument acts as a repeat count.  With a negative argument,
@@ -3598,7 +3750,7 @@
   ;; Note that this function does not do any hidden buffer changes.
 
   (let (fill
-	;; beg and end limits the region to narrow.  end is a marker.
+	;; beg and end limit the region to narrow.  end is a marker.
 	beg end
 	;; tmp-pre and tmp-post mark strings that are temporarily
 	;; inserted at the start and end of the region.  tmp-pre is a
@@ -3621,9 +3773,12 @@
     ;; Restore point on undo.  It's necessary since we do a lot of
     ;; hidden inserts and deletes below that should be as transparent
     ;; as possible.
-    (if (and buffer-undo-list (not (eq buffer-undo-list t)))
+      (if (and buffer-undo-list (not (eq buffer-undo-list t)))
 	(setq buffer-undo-list (cons (point) buffer-undo-list)))
 
+    ;; Determine the limits and type of the containing literal (if any):
+    ;; C-LIT-LIMITS, C-LIT-TYPE;  and the limits of the current paragraph:
+    ;; BEG and END.
     (c-save-buffer-state ()
       (save-restriction
 	;; Widen to catch comment limits correctly.
@@ -3651,6 +3806,13 @@
 
     (unwind-protect
 	(progn
+	  ;; For each of the possible types of text (string, C comment ...)
+	  ;; determine BEG and END, the region we will narrow to.  If we're in
+	  ;; a literal, constrain BEG and END to the limits of this literal.
+	  ;;
+	  ;; For some of these text types, particularly a block comment, we
+	  ;; may need to massage whitespace near literal delimiters, so that
+	  ;; these don't get filled inappropriately.
 	  (cond
 
 	   ((eq c-lit-type 'c++)	; Line comment.
@@ -3674,22 +3836,34 @@
 	    (setq apply-outside-literal t))
 
 	   ((eq c-lit-type 'c)		; Block comment.
-	    (when (>= end (cdr c-lit-limits))
-	      ;; The region includes the comment ender which we might
-	      ;; want to keep together with the last word.
-	      (unless (save-excursion
-			(goto-char (cdr c-lit-limits))
-			(beginning-of-line)
-			(and (looking-at (concat "[ \t]*\\("
-						 c-current-comment-prefix
-						 "\\)\\*/"))
-			     (eq (cdr c-lit-limits) (match-end 0))
-			     ;; The comment ender is on a line of its
-			     ;; own.  Keep it that way.
-			     (set-marker end (point))))
-
-		;; The comment ender should hang.  Replace all space between
-		;; it and the last word either by one or two 'x's (when
+	    (when
+		(or (> end (cdr c-lit-limits))
+		    (and (= end (cdr c-lit-limits))
+			 (eq (char-before end) ?/)
+			 (eq (char-before (1- end)) ?*)
+			 ;; disallow "/*/"
+			 (> (- (cdr c-lit-limits) (car c-lit-limits)) 3)))
+	      ;; There is a comment ender, and the region includes it.  If
+	      ;; it's on its own line, it stays on its own line.  If it's got
+	      ;; company on the line, it keeps (at least one word of) it.
+	      ;; "=====*/" counts as a comment ender here, but "===== */"
+	      ;; doesn't and "foo*/" doesn't.
+	      (unless
+		  (save-excursion
+		    (goto-char (cdr c-lit-limits))
+		    (beginning-of-line)
+		    (and (search-forward-regexp
+			  (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
+			  (- (cdr c-lit-limits) 2) t)
+			 (not (search-forward-regexp
+			       "\\(\\s \\|\\sw\\)"
+			       (- (cdr c-lit-limits) 2) 'limit))
+			     ;; The comment ender IS on its own line.  Exclude
+			     ;; this line from the filling.
+			 (set-marker end (c-point 'bol))))
+
+		;; The comment ender is hanging.  Replace all space between it
+		;; and the last word either by one or two 'x's (when
 		;; FILL-PARAGRAPH is non-nil), or a row of x's the same width
 		;; as the whitespace (when auto filling), and include it in
 		;; the region.  We'll change them back to whitespace
@@ -3706,23 +3880,26 @@
 		       spaces)
 
 		  (save-excursion
+		    ;; Insert a CR after the "*/", adjust END
 		    (goto-char (cdr c-lit-limits))
 		    (setq tmp-post (point-marker))
 		    (insert ?\n)
 		    (set-marker end (point))
+
 		    (forward-line -1)	; last line of the comment
 		    (if (and (looking-at (concat "[ \t]*\\(\\("
 						 c-current-comment-prefix
 						 "\\)[ \t]*\\)"))
 			     (eq ender-start (match-end 0)))
-			;; The comment ender is prefixed by nothing
-			;; but a comment line prefix.  Remove it
-			;; along with surrounding ws.
+			;; The comment ender is prefixed by nothing but a
+			;; comment line prefix.  IS THIS POSSIBLE?  (ACM,
+			;; 2006/4/28).  Remove it along with surrounding ws.
 			(setq spaces (- (match-end 1) (match-end 2)))
 		      (goto-char ender-start))
 		    (skip-chars-backward " \t\r\n") ; Surely this can be
 					; " \t"? "*/" is NOT alone on the line (ACM, 2005/8/18)
 
+		    ;; What's being tested here?  2006/4/20.  FIXME!!!
 		    (if (/= (point) ender-start)
 			(progn
 			  (if (<= here (point))
@@ -4172,49 +4349,63 @@
 When point is inside a comment, continue it with the appropriate
 comment prefix (see the `c-comment-prefix-regexp' and
 `c-block-comment-prefix' variables for details).  The end of a
-C++-style line comment doesn't count as inside it."
+C++-style line comment doesn't count as inside it.
+
+When point is inside a string, only insert a backslash when it is also
+inside a preprocessor directive."
 
   (interactive "*")
   (let* (c-lit-limits c-lit-type
 	 (c-macro-start c-macro-start))
 
-    (if (c-save-buffer-state ()
-	  (setq c-lit-limits (c-literal-limits nil nil t)
-		c-lit-type (c-literal-type c-lit-limits))
-	  (or (eq c-lit-type 'c)
-	      (and (eq c-lit-type 'c++)
-		   (< (save-excursion
-			(skip-chars-forward " \t")
-			(point))
-		      (1- (cdr (setq c-lit-limits (c-collect-line-comments
-						   c-lit-limits))))))
-	      (and (or (not (looking-at "\\s *$"))
-		       (eq (char-before) ?\\))
-		   (c-query-and-set-macro-start)
-		   (<= (save-excursion
-			 (goto-char c-macro-start)
-			 (if (looking-at c-opt-cpp-start)
-			     (goto-char (match-end 0)))
-			 (point))
-		       (point)))))
-
-	(let ((comment-multi-line t)
-	      (fill-prefix nil))
-	  (c-indent-new-comment-line nil t))
-
-      (delete-horizontal-space)
-      (newline)
-
+    (c-save-buffer-state ()
+      (setq c-lit-limits (c-literal-limits nil nil t)
+	    c-lit-type (c-literal-type c-lit-limits))
+      (when (eq c-lit-type 'c++)
+	(setq c-lit-limits (c-collect-line-comments c-lit-limits)))
+      (c-query-and-set-macro-start))
+
+    (cond
+     ((or (eq c-lit-type 'c)
+	  (and (eq c-lit-type 'c++) ; C++ comment, but not at the very end of it.
+	       (< (save-excursion
+		    (skip-chars-forward " \t")
+		    (point))
+		  (1- (cdr c-lit-limits))))
+	  (and (numberp c-macro-start)	; Macro, but not at the very end of
+					; it, not in a string, and not in the
+					; cpp keyword.
+	       (not (eq c-lit-type 'string))
+	       (or (not (looking-at "\\s *$"))
+		   (eq (char-before) ?\\))
+	       (<= (save-excursion
+		     (goto-char c-macro-start)
+		     (if (looking-at c-opt-cpp-start)
+			 (goto-char (match-end 0)))
+		     (point))
+		   (point))))
+      (let ((comment-multi-line t)
+	    (fill-prefix nil))
+	(c-indent-new-comment-line nil t)))
+
+     ((eq c-lit-type 'string)
+      (if (and (numberp c-macro-start)
+	       (not (eq (char-before) ?\\)))
+	  (insert ?\\))
+      (newline))
+
+     (t (delete-horizontal-space)
+	(newline)
       ;; c-indent-line may look at the current indentation, so let's
       ;; start out with the same indentation as the previous line.
-      (let ((col (save-excursion
-		   (forward-line -1)
-		   (while (and (looking-at "[ \t]*\\\\?$")
-			       (= (forward-line -1) 0)))
-		   (current-indentation))))
-	(indent-to col))
-
-      (indent-according-to-mode))))
+	(let ((col (save-excursion
+		     (backward-char)
+		     (forward-line 0)
+		     (while (and (looking-at "[ \t]*\\\\?$")
+				 (= (forward-line -1) 0)))
+		     (current-indentation))))
+	  (indent-to col))
+     (indent-according-to-mode)))))
 
 (defun c-context-open-line ()
   "Insert a line break suitable to the context and leave point before it.
--- a/lisp/progmodes/cc-defs.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-defs.el	Sat Jan 06 15:25:16 2007 +0000
@@ -95,7 +95,7 @@
 
 ;;; Variables also used at compile time.
 
-(defconst c-version "5.31.3"
+(defconst c-version "5.31.4"
   "CC Mode version number.")
 
 (defconst c-version-sym (intern c-version))
@@ -764,7 +764,7 @@
 ;; call `c-beginning-of-statement-1'.
 ;;
 ;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing
-;; scheme used by the `c-at-vsemp-p-fn', hence the name - the status is
+;; scheme used by the `c-at-vsemi-p-fn', hence the name - the status is
 ;; "unknown" if there is no cache entry current for the line. 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -1620,7 +1620,7 @@
 
 (defmacro c-lang-defconst (name &rest args)
   "Set the language specific values of the language constant NAME.
-The second argument can be an optional docstring.  The rest of the
+The second argument can optionally be a docstring.  The rest of the
 arguments are one or more repetitions of LANG VAL where LANG specifies
 the language(s) that VAL applies to.  LANG is the name of the
 language, i.e. the mode name without the \"-mode\" suffix, or a list
@@ -1717,7 +1717,7 @@
 	;; Emacs has a weird bug where it seems to fail to read
 	;; backquote lists from byte compiled files correctly (,@
 	;; forms, to be specific), so make sure the bindings in the
-	;; expansion below doesn't contain any backquote stuff.
+	;; expansion below don't contain any backquote stuff.
 	;; (XEmacs handles it correctly and doesn't need this for that
 	;; reason, but we also use this expansion handle
 	;; `c-lang-defconst-eval-immediately' and to register
--- a/lisp/progmodes/cc-engine.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-engine.el	Sat Jan 06 15:25:16 2007 +0000
@@ -255,6 +255,18 @@
 	     (forward-char)
 	     t))))
 
+(defun c-forward-over-cpp-define-id ()
+  ;; Assuming point is at the "#" that introduces a preprocessor
+  ;; directive, it's moved forward to the end of the identifier which is
+  ;; "#define"d (or whatever c-opt-cpp-macro-define specifies).  Non-nil
+  ;; is returned in this case, in all other cases nil is returned and
+  ;; point isn't moved.
+  ;;
+  ;; This function might do hidden buffer changes.
+  (when (and c-opt-cpp-macro-define-id
+	     (looking-at c-opt-cpp-macro-define-id))
+    (goto-char (match-end 0))))
+
 (defun c-forward-to-cpp-define-body ()
   ;; Assuming point is at the "#" that introduces a preprocessor
   ;; directive, it's moved forward to the start of the definition body
@@ -2442,14 +2454,14 @@
 		(= (c-backward-token-2 0) 0))
 
        (cond ((and (looking-at c-overloadable-operators-regexp)
-		   (or (not c-opt-op-identitier-prefix)
+		   (or (not c-opt-op-identifier-prefix)
 		       (and (= (c-backward-token-2 1) 0)
-			    (looking-at c-opt-op-identitier-prefix))))
+			    (looking-at c-opt-op-identifier-prefix))))
 	      (point))
 
 	     ((save-excursion
-		(and c-opt-op-identitier-prefix
-		     (looking-at c-opt-op-identitier-prefix)
+		(and c-opt-op-identifier-prefix
+		     (looking-at c-opt-op-identifier-prefix)
 		     (= (c-forward-token-2 1) 0)
 		     (looking-at c-overloadable-operators-regexp)))
 	      (point))))
@@ -3843,7 +3855,7 @@
 	;; good start position for the search, so do it.
 	(c-find-decl-prefix-search)))
 
-    ;; Now loop.  We already got the first match.
+    ;; Now loop.  Round what?  (ACM, 2006/7/5).  We already got the first match.
 
     (while (progn
 	     (while (and
@@ -4534,41 +4546,42 @@
 	  (goto-char start)
 	  nil)
 
-      (while (and
+      (while (progn
 	      (c-syntactic-skip-backward "^<;{}" limit t)
 
-	      (if (eq (char-before) ?<)
-		  t
-		;; Stopped at bob or a char that isn't allowed in an
-		;; arglist, so we've failed.
-		(goto-char start)
-		nil)
-
-	      (if (> (point)
-		     (progn (c-beginning-of-current-token)
-			    (point)))
-		  ;; If we moved then the "<" was part of some
-		  ;; multicharacter token.
-		  t
-
-		(backward-char)
-		(let ((beg-pos (point)))
-		  (if (c-forward-<>-arglist all-types)
-		      (cond ((= (point) start)
-			     ;; Matched the arglist.  Break the while.
-			     (goto-char beg-pos)
-			     nil)
-			    ((> (point) start)
-			     ;; We started from a non-paren ">" inside an
-			     ;; arglist.
-			     (goto-char start)
-			     nil)
-			    (t
-			     ;; Matched a shorter arglist.  Can be a nested
-			     ;; one so continue looking.
-			     (goto-char beg-pos)
-			     t))
-		    t)))))
+	      (and
+	       (if (eq (char-before) ?<)
+		   t
+		 ;; Stopped at bob or a char that isn't allowed in an
+		 ;; arglist, so we've failed.
+		 (goto-char start)
+		 nil)
+
+	       (if (> (point)
+		      (progn (c-beginning-of-current-token)
+			     (point)))
+		   ;; If we moved then the "<" was part of some
+		   ;; multicharacter token.
+		   t
+
+		 (backward-char)
+		 (let ((beg-pos (point)))
+		   (if (c-forward-<>-arglist all-types)
+		       (cond ((= (point) start)
+			      ;; Matched the arglist.  Break the while.
+			      (goto-char beg-pos)
+			      nil)
+			     ((> (point) start)
+			      ;; We started from a non-paren ">" inside an
+			      ;; arglist.
+			      (goto-char start)
+			      nil)
+			     (t
+			      ;; Matched a shorter arglist.  Can be a nested
+			      ;; one so continue looking.
+			      (goto-char beg-pos)
+			      t))
+		     t))))))
 
       (/= (point) start))))
 
@@ -5793,17 +5806,32 @@
       nil))))
 
 (defun c-forward-label (&optional assume-markup preceding-token-end limit)
-  ;; Assuming the point is at the beginning of a token, check if it
-  ;; starts a label and if so move over it and return t, otherwise
-  ;; don't move and return nil.  The end of the label is taken to be
-  ;; the end of the first submatch in `c-opt-extra-label-key' if it
-  ;; matched, otherwise it's the colon.  The point is directly after
-  ;; the end on return.  The terminating char is marked with
-  ;; `c-decl-end' to improve recognition of the following declaration
-  ;; or statement.
+  ;; Assuming that point is at the beginning of a token, check if it starts a
+  ;; label and if so move over it and return t, otherwise don't move and
+  ;; return nil.  "Label" here means "most things with a colon".
+  ;;
+  ;; More precisely, a "label" is regarded as one of:
+  ;; (i) a goto target like "foo:";
+  ;; (ii) A case label - either the entire construct "case FOO:" or just the
+  ;;   bare "case", should the colon be missing;
+  ;; (iii) a keyword which needs a colon, like "default:" or "private:";
+  ;; (iv) One of QT's "extended" C++ variants of
+  ;; "private:"/"protected:"/"public:"/"more:" looking like "public slots:".
+  ;; (v) One of the keywords matched by `c-opt-extra-label-key' (without any
+  ;;   colon).  Currently (2006-03), this applies only to Objective C's
+  ;;   keywords "@private", "@protected", and "@public".
+  ;;
+  ;; One of the things which will NOT be recognised as a label is a bit-field
+  ;; element of a struct, something like "int foo:5".
+  ;;
+  ;; The end of the label is taken to be just after the colon, or the end of
+  ;; the first submatch in `c-opt-extra-label-key'.  The point is directly
+  ;; after the end on return.  The terminating char gets marked with
+  ;; `c-decl-end' to improve recognition of the following declaration or
+  ;; statement.
   ;;
   ;; If ASSUME-MARKUP is non-nil, it's assumed that the preceding
-  ;; label, if any, has been marked up like that.
+  ;; label, if any, has already been marked up like that.
   ;;
   ;; If PRECEDING-TOKEN-END is given, it should be the first position
   ;; after the preceding token, i.e. on the other side of the
@@ -5819,8 +5847,11 @@
   ;;
   ;; This function might do hidden buffer changes.
 
-  (let ((start (point)))
+  (let ((start (point))
+	qt-symbol-idx
+	macro-start)			; if we're in one.
     (cond
+     ;; "case" or "default" (Doesn't apply to AWK). 
      ((looking-at c-label-kwds-regexp)
       (let ((kwd-end (match-end 1)))
 	;; Record only the keyword itself for fontification, since in
@@ -5840,7 +5871,7 @@
 		 (match-beginning 2))
 
 	    (progn
-	      (goto-char (match-beginning 2))
+	      (goto-char (match-beginning 2)) ; just after the :
 	      (c-put-c-type-property (1- (point)) 'c-decl-end)
 	      t)
 
@@ -5851,6 +5882,7 @@
 	  (goto-char kwd-end)
 	  t)))
 
+     ;; @private, @protected, @public, in Objective C, or similar.
      ((and c-opt-extra-label-key
 	   (looking-at c-opt-extra-label-key))
       ;; For a `c-opt-extra-label-key' match, we record the whole
@@ -5862,7 +5894,8 @@
       (c-put-c-type-property (1- (point)) 'c-decl-end)
       t)
 
-     ((and c-recognize-colon-labels
+     ;; All other cases of labels.
+     ((and c-recognize-colon-labels	; nil for AWK and IDL, otherwise t.
 
 	   ;; A colon label must have something before the colon.
 	   (not (eq (char-after) ?:))
@@ -5890,7 +5923,8 @@
 		 (save-excursion
 		   (goto-char (1- preceding-token-end))
 		   (c-beginning-of-current-token)
-		   (looking-at c-label-prefix-re))
+		   (or (looking-at c-label-prefix-re)
+		       (looking-at c-block-stmt-1-key)))
 
 		 (and (eq (char-before preceding-token-end) ?\))
 		      (c-after-conditional)))
@@ -5899,7 +5933,8 @@
 	       (save-excursion
 		 (goto-char (1- preceding-token-end))
 		 (c-beginning-of-current-token)
-		 (looking-at c-label-prefix-re))
+		 (or (looking-at c-label-prefix-re)
+		     (looking-at c-block-stmt-1-key)))
 
 	       (cond
 		((eq (char-before preceding-token-end) ?\))
@@ -5907,26 +5942,52 @@
 
 		((eq (char-before preceding-token-end) ?:)
 		 ;; Might be after another label, so check it recursively.
-		 (save-excursion
-		   (goto-char (1- preceding-token-end))
-		   ;; Essentially the same as the
-		   ;; `c-syntactic-re-search-forward' regexp below.
-		   (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t)
-		   (let ((pte (point))
-			 ;; If the caller turned on recording for us,
-			 ;; it shouldn't apply when we check the
-			 ;; preceding label.
-			 c-record-type-identifiers)
-		     (c-forward-syntactic-ws)
-		     (c-forward-label nil pte start))))))))
-
-	   ;; Check that the next nonsymbol token is ":".  Allow '('
-	   ;; for the sake of macro arguments.  FIXME: Should build
-	   ;; this regexp from the language constants.
-	   (c-syntactic-re-search-forward
-	    "[[:?;{=*/%&|,<>!@+-]" limit t t)
-	   (eq (char-before) ?:)
-	   (not (eq (char-after) ?:)))
+		 (save-restriction
+		   (save-excursion
+		     (goto-char (1- preceding-token-end))
+		     ;; Essentially the same as the
+		     ;; `c-syntactic-re-search-forward' regexp below.
+		     (setq macro-start
+			   (save-excursion (and (c-beginning-of-macro)
+						(point))))
+		     (if macro-start (narrow-to-region macro-start (point-max)))
+		     (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t)
+		     ;; Note: the following should work instead of the
+		     ;; narrow-to-region above.  Investigate why not,
+		     ;; sometime.  ACM, 2006-03-31.
+		     ;; (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+"
+		     ;;				    macro-start t)
+		     (let ((pte (point))
+			   ;; If the caller turned on recording for us,
+			   ;; it shouldn't apply when we check the
+			   ;; preceding label.
+			   c-record-type-identifiers)
+		       ;; A label can't start at a cpp directive.  Check for
+		       ;; this, since c-forward-syntactic-ws would foul up on it.
+		       (unless (and c-opt-cpp-prefix (looking-at c-opt-cpp-prefix))
+			 (c-forward-syntactic-ws)
+			 (c-forward-label nil pte start))))))))))
+
+	   ;; Check that the next nonsymbol token is ":", or that we're in one
+	   ;; of QT's "slots" declarations.  Allow '(' for the sake of macro
+	   ;; arguments.  FIXME: Should build this regexp from the language
+	   ;; constants.
+	   (when (c-syntactic-re-search-forward
+		  "[ \t[:?;{=*/%&|,<>!@+-]" limit t t) ; not at EOB
+	     (backward-char)
+	     (setq qt-symbol-idx
+		   (and (c-major-mode-is 'c++-mode)
+			(string-match
+			 "\\(p\\(r\\(ivate\\|otected\\)\\|ublic\\)\\|more\\)\\>"
+			 (buffer-substring start (point)))))
+	     (c-forward-syntactic-ws limit)
+	     (when (or (looking-at ":\\([^:]\\|\\'\\)") ; A single colon.
+		       (and qt-symbol-idx
+			    (search-forward-regexp "\\=slots\\>" limit t)
+			    (progn (c-forward-syntactic-ws limit)
+				   (looking-at ":\\([^:]\\|\\'\\)")))) ; A single colon
+	       (forward-char)		; to after the colon.
+	       t)))
 
       (save-restriction
 	(narrow-to-region start (point))
@@ -6145,8 +6206,8 @@
 	      ;; so that we don't get stuck on that instead of the
 	      ;; function arglist.
 	      (c-forward-sexp))
-	     ((and c-opt-op-identitier-prefix
-		   (looking-at c-opt-op-identitier-prefix))
+	     ((and c-opt-op-identifier-prefix
+		   (looking-at c-opt-op-identifier-prefix))
 	      ;; Don't trip up on "operator ()".
 	      (c-forward-token-2 2 t)))
        (and (< (point) beg)
@@ -6263,10 +6324,10 @@
     (and c-overloadable-operators-regexp
 	 (zerop (c-backward-token-2 1 nil lim))
 	 (looking-at c-overloadable-operators-regexp)
-	 (or (not c-opt-op-identitier-prefix)
+	 (or (not c-opt-op-identifier-prefix)
 	     (and
 	      (zerop (c-backward-token-2 1 nil lim))
-	      (looking-at c-opt-op-identitier-prefix)))
+	      (looking-at c-opt-op-identifier-prefix)))
 	 (point))))
 
 (defsubst c-backward-to-block-anchor (&optional lim)
@@ -6314,7 +6375,7 @@
 		 ;; operator token preceded by "operator".
 		 (save-excursion
 		   (and (c-safe (c-backward-sexp) t)
-			(looking-at c-opt-op-identitier-prefix)))
+			(looking-at c-opt-op-identifier-prefix)))
 		 (and (eq (char-before) ?<)
 		      (c-with-syntax-table c++-template-syntax-table
 			(if (c-safe (goto-char (c-up-list-forward (point))))
@@ -6354,6 +6415,10 @@
       ;; construct, i.e. if it isn't preceded by ';', '}', ':', bob,
       ;; or an open paren.
       (let ((beg (point)) tentative-move)
+	;; Go back one "statement" each time round the loop until we're just
+	;; after a ;, }, or :, or at BOB or the start of a macro or start of
+	;; an ObjC method.  This will move over a multiple declaration whose
+	;; components are comma separated.
 	(while (and
 		;; Must check with c-opt-method-key in ObjC mode.
 		(not (and c-opt-method-key
@@ -6397,25 +6462,39 @@
 			   knr-argdecl-start))
 	    (goto-char fallback-pos))))
 
-      ;; `c-beginning-of-statement-1' counts each brace block as a
-      ;; separate statement, so the result will be 'previous if we've
-      ;; moved over any.  If they were brace list initializers we might
-      ;; not have moved over a declaration boundary though, so change it
-      ;; to 'same if we've moved past a '=' before '{', but not ';'.
-      ;; (This ought to be integrated into `c-beginning-of-statement-1',
-      ;; so we avoid this extra pass which potentially can search over a
-      ;; large amount of text.)
+      ;; `c-beginning-of-statement-1' counts each brace block as a separate
+      ;; statement, so the result will be 'previous if we've moved over any.
+      ;; So change our result back to 'same if necessary.
+      ;;
+      ;; If they were brace list initializers we might not have moved over a
+      ;; declaration boundary though, so change it to 'same if we've moved
+      ;; past a '=' before '{', but not ';'.  (This ought to be integrated
+      ;; into `c-beginning-of-statement-1', so we avoid this extra pass which
+      ;; potentially can search over a large amount of text.).  Take special
+      ;; pains not to get mislead by C++'s "operator=", and the like.
       (if (and (eq move 'previous)
 	       (c-with-syntax-table (if (c-major-mode-is 'c++-mode)
 					c++-template-syntax-table
 				      (syntax-table))
 		 (save-excursion
-		   (and (c-syntactic-re-search-forward "[;={]" start t t t)
-			(eq (char-before) ?=)
-			(c-syntactic-re-search-forward "[;{]" start t t)
-			(eq (char-before) ?{)
-			(c-safe (goto-char (c-up-list-forward (point))) t)
-			(not (c-syntactic-re-search-forward ";" start t t))))))
+		   (and
+		    (progn
+		      (while  ; keep going back to "[;={"s until we either find
+			    ; no more, or get to one which isn't an "operator ="
+			  (and (c-syntactic-re-search-forward "[;={]" start t t t)
+			       (eq (char-before) ?=)
+			       c-overloadable-operators-regexp
+			       c-opt-op-identifier-prefix
+			       (save-excursion
+				 (eq (c-backward-token-2) 0)
+				 (looking-at c-overloadable-operators-regexp)
+				 (eq (c-backward-token-2) 0)
+				 (looking-at c-opt-op-identifier-prefix))))
+		      (eq (char-before) ?=))
+		    (c-syntactic-re-search-forward "[;{]" start t t)
+		    (eq (char-before) ?{)
+		    (c-safe (goto-char (c-up-list-forward (point))) t)
+		    (not (c-syntactic-re-search-forward ";" start t t))))))
 	  (cons 'same nil)
 	(cons move nil)))))
 
@@ -6725,8 +6804,8 @@
 			(setq braceassignp
 			      (cond
 			       ;; Check for operator =
-			       ((and c-opt-op-identitier-prefix
-				     (looking-at c-opt-op-identitier-prefix))
+			       ((and c-opt-op-identifier-prefix
+				     (looking-at c-opt-op-identifier-prefix))
 				nil)
 			       ;; Check for `<opchar>= in Pike.
 			       ((and (c-major-mode-is 'pike-mode)
@@ -7000,6 +7079,11 @@
 			  stop-at-boi-only
 			  containing-sexp
 			  paren-state)
+  ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as
+  ;; needed with further syntax elements of the types `substatement',
+  ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and
+  ;; `defun-block-intro'.
+  ;; 
   ;; Do the generic processing to anchor the given syntax symbol on
   ;; the preceding statement: Skip over any labels and containing
   ;; statements on the same line, and then search backward until we
@@ -8085,7 +8169,9 @@
 	      (and (eq (char-before) ?})
 		   (save-excursion
 		     (let ((start (point)))
-		       (if c-state-cache
+		       (if (and c-state-cache
+				(consp (car c-state-cache))
+				(eq (cdar c-state-cache) (point)))
 			   ;; Speed up the backward search a bit.
 			   (goto-char (caar c-state-cache)))
 		       (c-beginning-of-decl-1 containing-sexp)
@@ -8103,26 +8189,30 @@
 
 	   ;; CASE 5J: we are at the topmost level, make
 	   ;; sure we skip back past any access specifiers
-	   ((save-excursion
-	      (setq placeholder (point))
-	      (or (memq char-before-ip '(?\; ?{ ?} nil))
-		  (c-at-vsemi-p before-ws-ip)
-		  (when (and (eq char-before-ip ?:)
-			     (eq (c-beginning-of-statement-1 lim)
-				 'label))
-		    (c-backward-syntactic-ws lim)
-		    (setq placeholder (point)))
-		  (and (c-major-mode-is 'objc-mode)
-		       (catch 'not-in-directive
-			 (c-beginning-of-statement-1 lim)
-			 (setq placeholder (point))
-			 (while (and (c-forward-objc-directive)
-				     (< (point) indent-point))
-			   (c-forward-syntactic-ws)
-			   (if (>= (point) indent-point)
-			       (throw 'not-in-directive t))
-			   (setq placeholder (point)))
-			 nil))))
+	   ((and
+	     ;; A macro continuation line is never at top level.
+	     (not (and macro-start
+		       (> indent-point macro-start)))
+	     (save-excursion
+	       (setq placeholder (point))
+	       (or (memq char-before-ip '(?\; ?{ ?} nil))
+		   (c-at-vsemi-p before-ws-ip)
+		   (when (and (eq char-before-ip ?:)
+			      (eq (c-beginning-of-statement-1 lim)
+				  'label))
+		     (c-backward-syntactic-ws lim)
+		     (setq placeholder (point)))
+		   (and (c-major-mode-is 'objc-mode)
+			(catch 'not-in-directive
+			  (c-beginning-of-statement-1 lim)
+			  (setq placeholder (point))
+			  (while (and (c-forward-objc-directive)
+				      (< (point) indent-point))
+			    (c-forward-syntactic-ws)
+			    (if (>= (point) indent-point)
+				(throw 'not-in-directive t))
+			    (setq placeholder (point)))
+			  nil)))))
 	    ;; For historic reasons we anchor at bol of the last
 	    ;; line of the previous declaration.  That's clearly
 	    ;; highly bogus and useless, and it makes our lives hard
@@ -8177,6 +8267,11 @@
 	    (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
 	    (c-add-syntax 'template-args-cont (c-point 'boi)))
 
+	   ;; CASE 5Q: we are at a statement within a macro.
+	   (macro-start
+	    (c-beginning-of-statement-1 containing-sexp)
+	    (c-add-stmt-syntax 'statement nil t containing-sexp paren-state))
+
 	   ;; CASE 5M: we are at a topmost continuation line
 	   (t
 	    (c-beginning-of-statement-1 (c-safe-position (point) paren-state))
--- a/lisp/progmodes/cc-langs.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-langs.el	Sat Jan 06 15:25:16 2007 +0000
@@ -685,6 +685,16 @@
 (c-lang-defvar c-opt-cpp-macro-define-start
   (c-lang-const c-opt-cpp-macro-define-start))
 
+(c-lang-defconst c-opt-cpp-macro-define-id
+  ;; Regexp matching everything up to the end of the identifier defined
+  ;; by a cpp define.
+  t (if (c-lang-const c-opt-cpp-macro-define)
+	(concat (c-lang-const c-opt-cpp-prefix)	; #
+		(c-lang-const c-opt-cpp-macro-define) ; define
+		"[ \t]+\\(\\sw\\|_\\)+")))
+(c-lang-defvar c-opt-cpp-macro-define-id
+  (c-lang-const c-opt-cpp-macro-define-id))
+
 (c-lang-defconst c-cpp-expr-directives
   "List if cpp directives (without the prefix) that are followed by an
 expression."
@@ -882,7 +892,7 @@
 
 (c-lang-defconst c-overloadable-operators
   "List of the operators that are overloadable, in their \"identifier
-form\".  See also `c-op-identitier-prefix'."
+form\".  See also `c-op-identifier-prefix'."
   t    nil
   c++  '("new" "delete" ;; Can be followed by "[]" but we ignore that.
 	 "+" "-" "*" "/" "%"
@@ -905,7 +915,7 @@
 (c-lang-defvar c-overloadable-operators-regexp
   (c-lang-const c-overloadable-operators-regexp))
 
-(c-lang-defconst c-opt-op-identitier-prefix
+(c-lang-defconst c-opt-op-identifier-prefix
   "Regexp matching the token before the ones in
 `c-overloadable-operators' when operators are specified in their
 \"identifier form\".  This typically matches \"operator\" in C++ where
@@ -916,8 +926,15 @@
 This regexp is assumed to not match any non-operator identifier."
   t   nil
   c++ (c-make-keywords-re t '("operator")))
-(c-lang-defvar c-opt-op-identitier-prefix
-  (c-lang-const c-opt-op-identitier-prefix))
+(c-lang-defvar c-opt-op-identifier-prefix
+  (c-lang-const c-opt-op-identifier-prefix))
+
+;; Note: the following alias is an old name which was a mis-spelling.  It has
+;; been corrected above and throughout cc-engine.el.  It will be removed at
+;; some release very shortly in the future.  ACM, 2006-04-14.
+(defalias 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix)
+(make-obsolete-variable 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix
+			"CC Mode 5.31.4, 2006-04-14")
 
 (c-lang-defconst c-other-op-syntax-tokens
   "List of the tokens made up of characters in the punctuation or
--- a/lisp/progmodes/cc-mode.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-mode.el	Sat Jan 06 15:25:16 2007 +0000
@@ -288,8 +288,9 @@
 			       c-mode-base-map global-map))
 
   ;; RMS says don't make these the default.
-;;  (define-key c-mode-base-map "\e\C-a"    'c-beginning-of-defun)
-;;  (define-key c-mode-base-map "\e\C-e"    'c-end-of-defun)
+  ;; (April 2006): RMS has now approved these commands as defaults.
+  (define-key c-mode-base-map "\e\C-a"    'c-beginning-of-defun)
+  (define-key c-mode-base-map "\e\C-e"    'c-end-of-defun)
 
   (define-key c-mode-base-map "\C-c\C-n"  'c-forward-conditional)
   (define-key c-mode-base-map "\C-c\C-p"  'c-backward-conditional)
@@ -728,8 +729,8 @@
     ;; We prevent this by temporarily removing `mode' from the Local Variables
     ;; section.
     (if (or c-file-style c-file-offsets)
-	(c-tentative-buffer-changes
-	  (let ((hack-local-variables-hook nil))
+	(let ((hack-local-variables-hook nil) (inhibit-read-only t))
+	  (c-tentative-buffer-changes
 	    (c-remove-any-local-eval-or-mode-variables)
 	    (hack-local-variables))
 	  nil))))
--- a/lisp/progmodes/cc-styles.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-styles.el	Sat Jan 06 15:25:16 2007 +0000
@@ -68,7 +68,10 @@
 			 (arglist-intro . c-lineup-arglist-intro-after-paren)
 			 (arglist-close . c-lineup-arglist)
 			 (inline-open . 0)
-			 (brace-list-open . +)))
+			 (brace-list-open . +)
+			 (topmost-intro-cont
+			  . (first c-lineup-topmost-intro-cont
+				   c-lineup-gnu-DEFUN-intro-cont))))
      (c-special-indent-hook . c-gnu-impose-minimum)
      (c-block-comment-prefix . ""))
 
--- a/lisp/progmodes/cc-vars.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cc-vars.el	Sat Jan 06 15:25:16 2007 +0000
@@ -622,10 +622,10 @@
  empty-defun-braces  -- Clean up empty defun braces by placing the
                         braces on the same line.  Clean up occurs when
                         the defun closing brace is typed.
- one-liner-defun     -- If the code inside a function body is a single
-                        line then remove any newlines between that
-                        line and the defun braces so that the whole
-                        body becomes a single line.
+ one-liner-defun     -- If the code inside a function body can fit in
+                        a single line, then remove any newlines
+                        between that line and the defun braces so that
+                        the whole body becomes a single line.
                         `c-max-one-liner-length' gives the maximum
                         length allowed for the resulting line.  Clean
                         up occurs when the closing brace is typed.
@@ -1604,7 +1604,8 @@
 
 (defvar c-indentation-style nil
   "Name of the currently installed style.
-Don't change this directly; call `c-set-style' instead.")
+Don't change this directly; call `c-set-style' instead, or set the variable
+`c-file-style' in the file's Local Variable list.")
 
 (defvar c-current-comment-prefix nil
   "The current comment prefix regexp.
--- a/lisp/progmodes/cfengine.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/cfengine.el	Sat Jan 06 15:25:16 2007 +0000
@@ -89,7 +89,7 @@
   ;; In the main syntax-table, backslash is marked as a punctuation, because
   ;; of its use in DOS-style directory separators.  Here we try to recognize
   ;; the cases where backslash is used as an escape inside strings.
-  '(("\\(\\(?:\\\\\\)+\\)\"" . "\\")))
+  '(("\\(\\(?:\\\\\\)+\\)\"" 1 "\\")))
 
 (defvar cfengine-imenu-expression
   `((nil ,(concat "^[ \t]*" (eval-when-compile
--- a/lisp/progmodes/ebrowse.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/ebrowse.el	Sat Jan 06 15:25:16 2007 +0000
@@ -1,7 +1,7 @@
 ;;; ebrowse.el --- Emacs C++ class browser & tags facility
 
 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-;; 2002, 2003, 2004, 2005, 2006
+;; 2002, 2003, 2004, 2005, 2006, 2007
 ;; Free Software Foundation Inc.
 
 ;; Author: Gerd Moellmann <gerd@gnu.org>
@@ -4230,13 +4230,13 @@
 ;;; Global key bindings
 
 ;;; The following can be used to bind key sequences starting with
-;;; prefix `\C-cb' to browse commands.
+;;; prefix `\C-c\C-m' to browse commands.
 
 (defvar ebrowse-global-map nil
   "*Keymap for Ebrowse commands.")
 
 
-(defvar ebrowse-global-prefix-key "\C-cC-m"
+(defvar ebrowse-global-prefix-key "\C-c\C-m"
   "Prefix key for Ebrowse commands.")
 
 
--- a/lisp/progmodes/gdb-ui.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/progmodes/gdb-ui.el	Sat Jan 06 15:25:16 2007 +0000
@@ -896,6 +896,12 @@
   :group 'gud
   :version "22.1")
 
+(defcustom gdb-max-children 40
+  "Maximum number of children allowed before Emacs asks"
+  :type 'integer
+  :group 'gud
+  :version "22.1")
+
 (defun gdb-speedbar-expand-node (text token indent)
   "Expand the node the user clicked on.
 TEXT is the text of the button we clicked on, a + or - item.
@@ -904,11 +910,17 @@
   (if (and gud-comint-buffer (buffer-name gud-comint-buffer))
       (progn
 	(cond ((string-match "+" text)	;expand this node
-	       (if (and (eq (buffer-local-value
-			     'gud-minor-mode gud-comint-buffer) 'gdba)
-			(string-equal gdb-version "pre-6.4"))
-		   (gdb-var-list-children token)
-		 (gdb-var-list-children-1 token)))
+	       (let* ((var (assoc token gdb-var-list))
+		      (expr (nth 1 var)) (children (nth 2 var)))
+		 (if (or (<= (string-to-number children) gdb-max-children)
+			  (y-or-n-p
+			   (format
+			    "%s has %s children. Continue? " expr children)))
+		     (if (and (eq (buffer-local-value
+				   'gud-minor-mode gud-comint-buffer) 'gdba)
+			      (string-equal gdb-version "pre-6.4"))
+			 (gdb-var-list-children token)
+		       (gdb-var-list-children-1 token)))))
 	      ((string-match "-" text)	;contract this node
 	       (dolist (var gdb-var-list)
 		 (if (string-match (concat token "\\.") (car var))
--- a/lisp/simple.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/simple.el	Sat Jan 06 15:25:16 2007 +0000
@@ -4088,7 +4088,7 @@
   (kill-region (point) (progn (forward-word arg) (point))))
 
 (defun backward-kill-word (arg)
-  "Kill characters backward until encountering the end of a word.
+  "Kill characters backward until encountering the beginning of a word.
 With argument, do this that many times."
   (interactive "p")
   (kill-word (- arg)))
--- a/lisp/subr.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/subr.el	Sat Jan 06 15:25:16 2007 +0000
@@ -1887,6 +1887,7 @@
 (defun momentary-string-display (string pos &optional exit-char message)
   "Momentarily display STRING in the buffer at POS.
 Display remains until next event is input.
+If POS is a marker, only its position is used; its buffer is ignored.
 Optional third arg EXIT-CHAR can be a character, event or event
 description list.  EXIT-CHAR defaults to SPC.  If the input is
 EXIT-CHAR it is swallowed; otherwise it is then available as
@@ -1894,30 +1895,21 @@
 Display MESSAGE (optional fourth arg) in the echo area.
 If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
   (or exit-char (setq exit-char ?\s))
-  (let ((inhibit-read-only t)
-	;; Don't modify the undo list at all.
-	(buffer-undo-list t)
-	(modified (buffer-modified-p))
-	(name buffer-file-name)
-	insert-end)
+  (let ((momentary-overlay (make-overlay pos pos nil t)))
+    (overlay-put momentary-overlay 'before-string
+		 (propertize string 'face 'momentary))
     (unwind-protect
 	(progn
-	  (save-excursion
-	    (goto-char pos)
-	    ;; defeat file locking... don't try this at home, kids!
-	    (setq buffer-file-name nil)
-	    (insert-before-markers string)
-	    (setq insert-end (point))
-	    ;; If the message end is off screen, recenter now.
-	    (if (< (window-end nil t) insert-end)
-		(recenter (/ (window-height) 2)))
-	    ;; If that pushed message start off the screen,
-	    ;; scroll to start it at the top of the screen.
-	    (move-to-window-line 0)
-	    (if (> (point) pos)
-		(progn
-		  (goto-char pos)
-		  (recenter 0))))
+	  ;; If the message end is off screen, recenter now.
+	  (if (< (window-end nil t) (+ pos (length string)))
+	      (recenter (/ (window-height) 2)))
+	  ;; If that pushed message start off the screen,
+	  ;; scroll to start it at the top of the screen.
+	  (move-to-window-line 0)
+	  (if (> (point) pos)
+	      (progn
+		(goto-char pos)
+		(recenter 0)))
 	  (message (or message "Type %s to continue editing.")
 		   (single-key-description exit-char))
 	  (let (char)
@@ -1937,11 +1929,7 @@
 	      (or (eq char exit-char)
 		  (eq char (event-convert-list exit-char))
 		  (setq unread-command-events (list char))))))
-      (if insert-end
-	  (save-excursion
-	    (delete-region pos insert-end)))
-      (setq buffer-file-name name)
-      (set-buffer-modified-p modified))))
+      (delete-overlay momentary-overlay))))
 
 
 ;;;; Overlay operations
--- a/lisp/textmodes/table.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/textmodes/table.el	Sat Jan 06 15:25:16 2007 +0000
@@ -6,7 +6,7 @@
 ;; Keywords: wp, convenience
 ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
 ;; Created: Sat Jul 08 2000 13:28:45 (PST)
-;; Revised: Thu Jul 20 2006 17:30:09 (PDT)
+;; Revised: Wed Jan 03 2007 13:23:46 (PST)
 
 ;; This file is part of GNU Emacs.
 
@@ -5358,7 +5358,7 @@
     (cond ((and (featurep 'xemacs)
 		(not (get 'table-disable-incompatibility-warning 'xemacs)))
 	   (put 'table-disable-incompatibility-warning 'xemacs t)
-	   (momentary-string-display
+	   (display-warning 'table
 	    "
 *** Warning ***
 
@@ -5369,12 +5369,12 @@
 aware of this.
 
 "
-	    (save-excursion (forward-line 1) (point))))
+	    :warning))
 	  ((and (boundp 'flyspell-mode)
 		flyspell-mode
 		(not (get 'table-disable-incompatibility-warning 'flyspell)))
 	   (put 'table-disable-incompatibility-warning 'flyspell t)
-	   (momentary-string-display
+	   (display-warning 'table
 	    "
 *** Warning ***
 
@@ -5383,7 +5383,7 @@
 works better than the previous versions however not fully compatible.
 
 "
-	    (save-excursion (forward-line 1) (point))))
+	    :warning))
 	  )))
 
 (defun table--cell-blank-str (&optional n)
--- a/lisp/tutorial.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/tutorial.el	Sat Jan 06 15:25:16 2007 +0000
@@ -153,7 +153,7 @@
                   (insert "\n\nYou can use M-x "
                           (format "%s" db)
                           " RET instead."))
-              (insert "\n\nWith you current key bindings"
+              (insert "\n\nWith your current key bindings"
                       " you can use the key "
                       where
                       " to get the function `"
--- a/lisp/wid-edit.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/wid-edit.el	Sat Jan 06 15:25:16 2007 +0000
@@ -275,14 +275,15 @@
 		     keys
 		     (char 0)
 		     (arg 1))
-		 (while (not (or (and (>= char ?0) (< char next-digit))
+		 (while (not (or (and (integerp char)
+				      (>= char ?0) (< char next-digit))
 				 (eq value 'keyboard-quit)))
 		   ;; Unread a SPC to lead to our new menu.
 		   (setq unread-command-events (cons ?\s unread-command-events))
 		   (setq keys (read-key-sequence title))
 		   (setq value
 			 (lookup-key overriding-terminal-local-map keys t)
-			 char (string-to-char (substring keys 1)))
+			 char (aref keys 1))
 		   (cond ((eq value 'scroll-other-window)
 			  (let ((minibuffer-scroll-window
 				 (get-buffer-window buf)))
--- a/lisp/woman.el	Mon Jan 01 18:32:06 2007 +0000
+++ b/lisp/woman.el	Sat Jan 06 15:25:16 2007 +0000
@@ -2112,7 +2112,7 @@
 		 (progn (goto-char (point-min))
 			(not (re-search-forward "^\\.\\([pnil]p\\|sh\\)[ \n]"
 						(point-max) t))))
-      (error "WoMan can only format manpages written in the an format")))
+      (error "WoMan can only format man pages written with the usual `-man' macros")))
 
   (and (boundp 'font-lock-mode) font-lock-mode (font-lock-mode -1))
   ;; (fundamental-mode)
--- a/lispref/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/lispref/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,22 @@
+2007-01-05  Richard Stallman  <rms@gnu.org>
+
+	* modes.texi (Defining Minor Modes): Fix previous change.
+
+2007-01-03  Richard Stallman  <rms@gnu.org>
+
+	* customize.texi (Variable Definitions, Customization Types): 
+	Don't use * in doc string for defcustom.
+
+2007-01-02  Richard Stallman  <rms@gnu.org>
+
+	* variables.texi (Variable Aliases): Clarify that aliases vars
+	always have the same value.
+
+	* processes.texi (Bindat Spec): Fix Texinfo usage.
+
+	* modes.texi (Defining Minor Modes): Explain effect of command
+	defined with define-global-minor-mode on new buffers.
+
 2006-12-30  Kim F. Storm  <storm@cua.dk>
 
 	* keymaps.texi (Tool Bar): Describe `grow-only' value of
--- a/lispref/customize.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/lispref/customize.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -409,7 +409,7 @@
 
 @example
 (defcustom save-place nil
-  "*Non-nil means automatically save place in each file..."
+  "Non-nil means automatically save place in each file..."
   :type 'boolean
   :require 'saveplace
   :group 'save-place)
@@ -461,7 +461,7 @@
 
 @example
 (defcustom diff-command "diff"
-  "*The command to use to run diff."
+  "The command to use to run diff."
   :type '(string)
   :group 'diff)
 @end example
--- a/lispref/modes.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/lispref/modes.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -1480,12 +1480,17 @@
 @end smallexample
 
 @defmac define-global-minor-mode global-mode mode turn-on keyword-args@dots{}
-This defines a global minor mode named @var{global-mode} whose meaning
-is to enable the buffer-local minor mode @var{mode} in every buffer.
-To turn on the minor mode in a buffer, it uses the function
+This defines a global toggle named @var{global-mode} whose meaning is
+to enable or disable the buffer-local minor mode @var{mode} in all
+buffers.  To turn on the minor mode in a buffer, it uses the function
 @var{turn-on}; to turn off the minor mode, it calls @code{mode} with
 @minus{}1 as argument.
 
+Globally enabling the mode also affects buffers subsequently created
+by visiting files, and buffers that use a major mode other than
+Fundamental mode; but it does not detect the creation of a new buffer
+in Fundamental mode.
+
 Use @code{:group @var{group}} in @var{keyword-args} to specify the
 custom group for the mode variable of the global minor mode.
 @end defmac
--- a/lispref/processes.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/lispref/processes.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -2247,7 +2247,7 @@
 The data as a byte array.
 
 @item bindat-idx
-Current index into bindat-raw of the unpacking or packing operation.
+Current index (within @code{bindat-raw}) for unpacking or packing.
 
 @item struct
 The alist containing the structured data that have been unpacked so
--- a/lispref/variables.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/lispref/variables.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -1777,9 +1777,11 @@
 
 @defun defvaralias new-alias base-variable &optional docstring
 This function defines the symbol @var{new-alias} as a variable alias
-for symbol @var{base-variable}. This means that retrieving the value of
-@var{new-alias} returns the value of @var{base-variable}, and changing the
-value of @var{new-alias} changes the value of @var{base-variable}.
+for symbol @var{base-variable}. This means that retrieving the value
+of @var{new-alias} returns the value of @var{base-variable}, and
+changing the value of @var{new-alias} changes the value of
+@var{base-variable}.  The two aliased variable names always share the
+same value and the same bindings.
 
 If the @var{docstring} argument is non-@code{nil}, it specifies the
 documentation for @var{new-alias}; otherwise, the alias gets the same
--- a/lwlib/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/lwlib/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,19 @@
+2007-01-01  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xlwmenu.c (xlwMenuResources): Add XtNleaveCallback, XtNenterCallback.
+	(display_menu, map_event_to_widget_value): Generate enter and
+	leave callbacks.
+	(pop_up_menu): Initialize mw->menu.inside_entry.
+
+	* xlwmenu.h (XtNleaveCallback, XtNenterCallback): New strings.
+
+	* xlwmenuP.h (_XlwMenu_part): Add enter/leave callbacks and
+	inside_entry.
+
+	* lwlib-Xlw.c (enter_hook, leave_hook): New functions
+	(xlw_create_menubar, xlw_create_popup_menu): Connect XtNenter/leave
+	to enter/leave_hook.
+
 2006-10-30  Chong Yidong  <cyd@stupidchicken.com>
 
 	* Makefile.in (lwlib-utils.o): Use CPPFLAGS.
--- a/lwlib/lwlib-Xlw.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/lwlib/lwlib-Xlw.c	Sat Jan 06 15:25:16 2007 +0000
@@ -84,6 +84,25 @@
 }
 
 static void
+enter_hook (w, client_data, call_data)
+     Widget w;
+     XtPointer client_data;
+     XtPointer call_data;
+{
+  highlight_hook (w, client_data, call_data);
+}
+
+static void
+leave_hook (w, client_data, call_data)
+     Widget w;
+     XtPointer client_data;
+     XtPointer call_data;
+{
+  highlight_hook (w, client_data, NULL);
+}
+
+
+static void
 pre_hook (w, client_data, call_data)
      Widget w;
      XtPointer client_data;
@@ -152,8 +171,8 @@
 
   XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance);
   XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
-  XtAddCallback (widget, XtNhighlightCallback, highlight_hook,
-		 (XtPointer)instance);
+  XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance);
+  XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance);
   return widget;
 }
 
@@ -179,8 +198,8 @@
 			     popup_shell, al, ac);
 
   XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
-  XtAddCallback (widget, XtNhighlightCallback, highlight_hook,
-		 (XtPointer)instance);
+  XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance);
+  XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance);
 
   return popup_shell;
 }
--- a/lwlib/xlwmenu.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/lwlib/xlwmenu.c	Sat Jan 06 15:25:16 2007 +0000
@@ -161,6 +161,10 @@
      offset(menu.select), XtRCallback, (XtPointer)NULL},
   {XtNhighlightCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
      offset(menu.highlight), XtRCallback, (XtPointer)NULL},
+  {XtNenterCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
+     offset(menu.enter), XtRCallback, (XtPointer)NULL},
+  {XtNleaveCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
+     offset(menu.leave), XtRCallback, (XtPointer)NULL},
   {XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer),
      offset(menu.contents), XtRImmediate, (XtPointer)NULL},
   {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
@@ -1186,8 +1190,17 @@
 	{
 	  if (val->enabled)
 	    *hit_return = val;
-	  else
-	    no_return = 1;
+	  else 
+            no_return = 1;
+          if (mw->menu.inside_entry != val) 
+            {
+              if (mw->menu.inside_entry)
+                XtCallCallbackList ((Widget)mw, mw->menu.leave,
+                                    (XtPointer) mw->menu.inside_entry);
+              mw->menu.inside_entry = val;
+              XtCallCallbackList ((Widget)mw, mw->menu.enter,
+                                  (XtPointer) mw->menu.inside_entry);
+            }
 	}
 
       if (horizontal_p)
@@ -1452,7 +1465,7 @@
   relative_pos->x = ev->x_root - x;
   relative_pos->y = ev->y_root - y;
   return (x - shadow < ev->x_root && ev->x_root < x + ws->width
-	  && y - shadow < ev->y_root && ev->y_root < y + ws->height);
+          && y - shadow < ev->y_root && ev->y_root < y + ws->height);
 }
 
 static Boolean
@@ -1465,6 +1478,7 @@
   int 		i;
   XPoint	relative_pos;
   window_state*	ws;
+  int inside = 0;
 
   *val = NULL;
 
@@ -1474,6 +1488,7 @@
       ws = &mw->menu.windows [i];
       if (ws && motion_event_is_in_menu (mw, ev, i, &relative_pos))
 	{
+          inside = 1;
 	  display_menu (mw, i, True, NULL, &relative_pos, val, NULL, NULL);
 
 	  if (*val)
@@ -1483,6 +1498,15 @@
 	    }
 	}
     }
+
+  if (!inside) 
+    {
+      if (mw->menu.inside_entry != NULL) 
+        XtCallCallbackList ((Widget)mw, mw->menu.leave,
+                            (XtPointer) mw->menu.inside_entry);
+      mw->menu.inside_entry = NULL;
+    }
+
   return False;
 }
 
@@ -2426,6 +2450,7 @@
 
   next_release_must_exit = 0;
 
+  mw->menu.inside_entry = NULL;
   XtCallCallbackList ((Widget)mw, mw->menu.open, NULL);
 
   if (XtIsShell (XtParent ((Widget)mw)))
--- a/lwlib/xlwmenu.h	Mon Jan 01 18:32:06 2007 +0000
+++ b/lwlib/xlwmenu.h	Sat Jan 06 15:25:16 2007 +0000
@@ -44,6 +44,8 @@
 #define XtNopen "open"
 #define XtNselect "select"
 #define XtNhighlightCallback "highlightCallback"
+#define XtNenterCallback "enterCallback"
+#define XtNleaveCallback "leaveCallback"
 #define XtNmenuBorderWidth "menuBorderWidth"
 #define XtNhorizontal "horizontal"
 #define XtCHorizontal "Horizontal"
--- a/lwlib/xlwmenuP.h	Mon Jan 01 18:32:06 2007 +0000
+++ b/lwlib/xlwmenuP.h	Sat Jan 06 15:25:16 2007 +0000
@@ -64,6 +64,7 @@
   Cursor	cursor_shape;
   XtCallbackList	open;
   XtCallbackList	select, highlight;
+  XtCallbackList        enter, leave;
   widget_value*	contents;
   int		horizontal;
 
@@ -76,6 +77,7 @@
   int			old_depth;
   widget_value**	old_stack;
   int			old_stack_length;
+  widget_value*         inside_entry;
 
   /* New state after the user moved */
   int			new_depth;
--- a/man/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,85 @@
+2007-01-05  Richard Stallman  <rms@gnu.org>
+
+	* anti.texi (Antinews): Mention M-x shell scrolling.
+
+2007-01-05  Nick Roberts  <nickrob@snap.net.nz>
+
+	* building.texi (Watch Expressions): Describe gdb-max-children.
+
+2007-01-05  Michael Olson  <mwolson@gnu.org>
+
+	* erc.texi (Getting Started): Update for /RECONNECT command.
+
+2007-01-04  Richard Stallman  <rms@gnu.org>
+
+	* ebrowse.texi: Change C-c b to C-c C-m.
+
+	* msdog.texi (Windows Keyboard): Clarify previous change.
+
+2007-01-03  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus.texi (Customizing Articles): Use index entries for gnus-treat-*
+	variables only in info to avoid redundant entries in the printed
+	manual.
+
+2007-01-02  Richard Stallman  <rms@gnu.org>
+
+	* custom.texi (Changing a Variable): Minor clarification.
+	(Specific Customization): customize-customized => customize-unsaved.
+
+	* entering.texi (Entering Emacs): Clean up text about restarting 
+	Emacs for each file.
+
+	* misc.texi (Shell Options): Minor cleanup.
+
+	* msdog.texi (Windows Keyboard): Explain that Windows was incompatible
+	with Emacs, not vice versa.
+
+	* programs.texi (Symbol Completion): Recommend customizing window
+	manager.
+
+	* xresources.texi (Resources): Minor fix.
+
+2007-01-02  Daiki Ueno  <ueno@unixuser.org>
+
+	* message.texi (Using PGP/MIME): Document gpg-agent usage.
+
+2007-01-02  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* message.texi (Security): Split into sub-nodes.
+
+2007-01-01  Alan Mackenzie  <acm@muc.de>
+
+	* cc-mode.texi ("Limitations and Known Bugs"): Document problems with
+	eval-after-load in Emacs <=21 and a workaround.  Document that
+	trigraphs are not supported.
+
+2007-01-01  Alan Mackenzie  <acm@muc.de>
+
+	* cc-mode.texi ("Filling and Breaking"): Amend the doc for
+	c-context-line-break.  When invoked within a string, preserve
+	whitespace.  Add a backslash only when also in a macro.
+
+2007-01-01  Alan Mackenzie  <acm@muc.de>
+
+	* cc-mode.texi ("Choosing a Style"): Mention c-file-style.
+
+2007-01-01  Alan Mackenzie  <acm@muc.de>
+
+	* cc-mode.texi ("Movement Commands", "Sample .emacs File"): C-M-[ae]
+	are now bound by default to c-\(beginning\|end\)-of-defun by default.
+
+2007-01-01  Alan Mackenzie  <acm@muc.de>
+
+	* cc-mode.texi ("Other Commands"): Move c-set-style (C-c .) here from
+	"Choosing a Style".
+
+	* cc-mode.texi ("Styles"): Add @dfn{style}.
+
+2007-01-01  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xresources.texi (Table of Resources): Add scrollBarWidth resource.
+
 2007-01-01  Richard Stallman  <rms@gnu.org>
 
 	* commands.texi (User Input): Document keys stolen by window mangers.
@@ -53,7 +135,6 @@
 	(IMAP): Document nnimap-search-uids-not-since-is-evil and
 	nnimap-nov-is-evil.
 
->>>>>>> 1.1170
 2006-12-27  Eli Zaretskii  <eliz@gnu.org>
 
 	* msdog.texi (Windows Keyboard): Mention widespread Windows bindings,
--- a/man/anti.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/anti.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -173,6 +173,11 @@
 variable @code{Info-fontify}.
 
 @item
+@samp{M-x shell} is now completely standard in regard to scrolling
+behavior.  It no longer has the option of scrolling the input line to
+the bottom of the window the way a text terminal running a shell does.
+
+@item
 The Grep package has been merged with Compilation mode.  Many
 grep-specific commands and user options have thus been eliminated.
 Also, @kbd{M-x grep} never tries the GNU grep @samp{-H} option,
--- a/man/building.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/building.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -1099,8 +1099,11 @@
 also display the frame address as a tooltip to help identify the frame
 in which they were defined.
 
-  To expand or contract a complex data type, click @kbd{Mouse-2}
-or press @key{SPC} on the tag to the left of the expression.
+  To expand or contract a complex data type, click @kbd{Mouse-2} or
+press @key{SPC} on the tag to the left of the expression.  Emacs asks
+for confirmation before expanding the expression if its number of
+immediate children exceeds the value of the variable
+@code{gdb-max-children}.
 
 @kindex D @r{(GDB speedbar)}
 @findex gdb-var-delete
--- a/man/cc-mode.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/cc-mode.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -486,7 +486,7 @@
 have the latest @ccmode{} release and might want to upgrade your copy
 (see below).
 
-You should probably start by reading the entire chapter
+You should probably start by skimming through the entire chapter
 @ref{Commands} to get an overview of @ccmode{}'s capabilities.
 
 After trying out some commands, you may dislike some aspects of
@@ -687,7 +687,7 @@
 @item
 When it's @code{nil}, the command indents the line by an extra
 @code{c-basic-offset} columns.  A prefix argument acts as a
-multiplier.  A bare prefix (@kbd{C-u @key{TAB}} is equivalent to -1,
+multiplier.  A bare prefix (@kbd{C-u @key{TAB}}) is equivalent to -1,
 removing @code{c-basic-offset} columns from the indentation.
 @end itemize
 
@@ -880,30 +880,29 @@
 @ccmode{} contains some useful commands for moving around in C code.
 
 @table @asis
-@item @kbd{M-x c-beginning-of-defun}
-@itemx @kbd{M-x c-end-of-defun}
+@item @kbd{C-M-a}
+@itemx @kbd{C-M-e}
 @findex c-beginning-of-defun
 @findex c-end-of-defun
-@findex beginning-of-defun (c-)
-@findex end-of-defun (c-)
-@findex beginning-of-defun
-@findex end-of-defun
-Move to the start or end of the current top-level definition.  This is
-the outermost brace pair which encloses point, together with the
-function header or similar preamble which precedes the opening brace.
+
+Move to the beginning or end of the current or next function.  Other
+constructs (such as a structs or classes) which have a brace block
+also count as ``functions'' here.  To move over several functions, you
+can give these commands a repeat count.
+
+The start of a function is at its header.  The end of the function is
+after its closing brace, or after the semicolon of a construct (such
+as a @code{struct}) which doesn't end at the brace.  These two
+commands try to leave point at the beginning of a line near the actual
+start or end of the function.  This occasionally causes point not to
+move at all.
+
 These functions are analogous to the Emacs built-in commands
 @code{beginning-of-defun} and @code{end-of-defun}, except they
 eliminate the constraint that the top-level opening brace of the defun
 must be in column zero.  See @ref{Defuns,,,@emacsman{},
 @emacsmantitle{}}, for more information.
 
-Depending on the coding style you're using, you might prefer these two
-commands to the standard Emacs ones.  If so, consider binding them to
-@kbd{C-M-a} and @kbd{C-M-e}.  @xref{Sample .emacs File}.  This
-customization won't affect the special bindings for these key
-sequences in force in AWK Mode.  For backwards compatibility reasons,
-the default bindings for @kbd{C-M-a} and @kbd{C-M-e} remain in effect.
-
 @item @kbd{C-M-a} (AWK Mode) (@code{c-awk-beginning-of-defun})
 @itemx @kbd{C-M-e} (AWK Mode) (@code{c-awk-end-of-defun})
 @kindex C-M-a (AWK Mode)
@@ -912,11 +911,9 @@
 @findex awk-beginning-of-defun (c-)
 @findex c-awk-end-of-defun
 @findex awk-end-of-defun (c-)
-Move back to the beginning or forward to the end of the current AWK
-defun.  These functions are bound to @kbd{C-M-a} and @kbd{C-M-e} by
-default in AWK Mode.  They can take prefix-arguments, their
-functionality being entirely equivalent to @code{beginning-of-defun}
-and @code{end-of-defun}.
+Move to the beginning or end of the current or next AWK defun.  These
+commands can take prefix-arguments, their functionality being entirely
+equivalent to @code{beginning-of-defun} and @code{end-of-defun}.
 
 AWK Mode @dfn{defuns} are either pattern/action pairs (either of which
 might be implicit) or user defined functions.  Having the @samp{@{} and
@@ -1094,7 +1091,10 @@
 indented like @code{newline-and-indent} would do.  In macros it acts
 like @code{newline-and-indent} but additionally inserts and optionally
 aligns the line ending backslash so that the macro remains unbroken.
-@xref{Custom Macros}, for details about the backslash alignment.
+@xref{Custom Macros}, for details about the backslash alignment.  In a
+string, a backslash is inserted only if the string is within a
+macro@footnote{In GCC, unescaped line breaks within strings are
+valid.}.
 
 This function is not bound to a key by default, but it's intended to be
 used on the @kbd{RET} key.  If you like the behavior of
@@ -1710,6 +1710,25 @@
 Here are the various other commands that didn't fit anywhere else:
 
 @table @asis
+@item @kbd{C-c .} (@code{c-set-style})
+@kindex C-c .
+@findex c-set-style
+@findex set-style (c-)
+Switch to the specified style in the current buffer.  Use like this:
+
+@example
+@kbd{C-c . @var{style-name} @key{RET}}
+@end example
+
+You can use the @key{TAB} in the normal way to do completion on the
+style name.  Note that all style names are case insensitive, even the
+ones you define yourself.
+
+Setting a style in this way does @emph{not} automatically reindent your
+file.  For commands that you can use to view the effect of your changes,
+see @ref{Indentation Commands} and @ref{Filling and Breaking}.
+
+For details of the @ccmode{} style system, see @ref{Styles}.
 @item @kbd{C-c :} (@code{c-scope-operator})
 @kindex C-c :
 @findex c-scope-operator
@@ -2363,7 +2382,7 @@
 @end defvar
 
 Although these hooks are variables defined in @ccmode{}, you can give
-them values before @ccmode{}'s code is loaded - indeed, this is the
+them values before @ccmode{}'s code is loaded---indeed, this is the
 only way to use @code{c-initialization-hook}.  Their values aren't
 overwritten when @ccmode{} gets loaded.
 
@@ -2476,6 +2495,11 @@
 @cindex styles
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
+By @dfn{style} we mean the layout of the code---things like how many
+columns to indent a block of code, whether an opening brace gets
+indented to the level of the code it encloses, or of the construct
+that introduces it, or ``hangs'' at the end of a line.
+
 Most people only need to edit code formatted in just a few well-defined
 and consistent styles.  For example, their organization might impose a
 ``blessed'' style that all its programmers must conform to.  Similarly,
@@ -2577,35 +2601,19 @@
 @subsection Choosing a Style
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-Use @kbd{C-c .} to choose a style interactively:
-
-@deffn Command c-set-style style-name
-@findex set-style (c-)
-@kindex C-c .
-Switch to the specified style in the current buffer.  Use
-interactively like this:
-
-@example
-@kbd{C-c . @var{style-name} @key{RET}}
-@end example
-
-You can use the @key{TAB} in the normal way to do completion on the
-style name.  Note that all style names are case insensitive, even the
-ones you define yourself.
-
-Setting a style in this way does @emph{not} automatically reindent your
-file.  For commands that you can use to view the effect of your changes,
-see @ref{Indentation Commands} and @ref{Filling and Breaking}.
-@end deffn
-
-The default style in all newly created buffers is @code{gnu}, except
-in Java and AWK modes where it's @code{java} and @code{awk}.
+When you create a new buffer, its style will be set from
+@code{c-default-style}.  The factory default is the style @code{gnu},
+except in Java and AWK modes where it's @code{java} and @code{awk}.
 
 Remember that if you set a style variable with the Customization
 interface or at the top level of your @file{.emacs} file before the
 style system is initialised (@pxref{Config Basics}), this setting will
 override the one that the style system would have given the variable.
 
+To set a buffer's style interactively, use the command @kbd{C-c .}
+(@pxref{Other Commands}).  To set it from a file's local variable
+list, @ref{File Styles}.
+
 @defopt c-default-style
 @vindex default-style (c-)
 This variable specifies which style to install by default in new
@@ -3247,8 +3255,8 @@
 
 This variable is also bound in three other circumstances:
 (i)@w{ }when calling a c-hanging-semi&comma-criteria function
-(@pxref{Hanging Semicolons and Commas}; (ii)@w{ }when calling a
-line-up function (@pxref{Custom Line-Up}; (iii)@w{ }when calling a
+(@pxref{Hanging Semicolons and Commas}); (ii)@w{ }when calling a
+line-up function (@pxref{Custom Line-Up}); (iii)@w{ }when calling a
 c-special-indent-hook function (@pxref{Other Indentation}).
 @end defvar
 
@@ -3430,7 +3438,11 @@
 @dfn{Clean-ups} are mechanisms which remove (or exceptionally, add)
 whitespace in specific circumstances and are complementary to colon
 and brace hanging.  You enable a clean-up by adding its symbol into
-@code{c-cleanup-list}.
+@code{c-cleanup-list}, e.g. like this:
+
+@example
+(add-to-list 'c-cleanup-list 'space-before-funcall)
+@end example
 
 On the surface, it would seem that clean-ups overlap the functionality
 provided by the @code{c-hanging-*-alist} variables.  Clean-ups,
@@ -3661,10 +3673,11 @@
 closing parenthesis is typed.
 
 @item comment-close-slash
-When inside a block comment, terminate the comment when you type a
-slash at the beginning of a line (i.e. immediately after the comment
-prefix).  This clean-up removes whitespace preceding the slash and if
-needed, inserts a star to complete the token @samp{*/}.
+When inside a block comment, terminate the comment when you type a slash
+at the beginning of a line (i.e. immediately after the comment prefix).
+This clean-up removes whitespace preceding the slash and if needed,
+inserts a star to complete the token @samp{*/}.  Type @kbd{C-q /} in this
+situation if you just want a literal @samp{/} inserted.
 @end table
 
 
@@ -5182,7 +5195,7 @@
 offset of 0 (zero) is used@footnote{There is however a variable
 @code{c-strict-syntax-p} that when set to non-@code{nil} will cause an
 error to be signaled in that case.  It's now considered obsolete since
-it doesn't work well with some of the alignment functions that returns
+it doesn't work well with some of the alignment functions that return
 @code{nil} instead of zero.  You should therefore leave
 @code{c-strict-syntax-p} set to @code{nil}.}.
 
@@ -6549,18 +6562,16 @@
 @appendix Sample .emacs File
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
+Here's a sample .emacs file fragment that might help you along the way.
+Just copy this region and paste it into your .emacs file.  You might want
+to change some of the actual values.
+
 @verbatim
-;; Here's a sample .emacs file fragment that might help you along the
-;; way.  Just copy this region and paste it into your .emacs file.
-;; You might want to change some of the actual values.
-
-;; Make some non-standard key bindings.  We can put these in
+;; Make a non-standard key binding.  We can put this in
 ;; c-mode-base-map because c-mode-map, c++-mode-map, and so on,
 ;; inherit from it.
 (defun my-c-initialization-hook ()
-  (define-key c-mode-base-map "\C-m" 'c-context-line-break)
-  (define-key c-mode-base-map [?\C-\M-a] 'c-beginning-of-defun)
-  (define-key c-mode-base-map [?\C-\M-e] 'c-end-of-defun))
+  (define-key c-mode-base-map "\C-m" 'c-context-line-break))
 (add-hook 'c-initialization-hook 'my-c-initialization-hook)
 
 ;; offset customizations not in my-c-style
@@ -6647,9 +6658,6 @@
 caches syntactic information much better, so that the delay caused by
 searching for such a brace when it's not in column 0 is minimal,
 except perhaps when you've just moved a long way inside the file.
-Don't forget to rebind @kbd{C-M-a} and @kbd{C-M-e} to the @ccmode{}
-functions @code{beginning-of-defun} and @code{end-of-defun} if you're
-going to be hanging your braces! @xref{Sample .emacs File}.
 
 @findex defun-prompt-regexp
 @vindex c-Java-defun-prompt-regexp
@@ -6726,6 +6734,12 @@
 
 @itemize @bullet
 @item
+@ccmode{} doesn't support trigraphs.  (These are character sequences
+such as @samp{??(}, which represents @samp{[}.  They date from a time
+when some character sets didn't have all the characters that C needs,
+and are now utterly obsolete.)
+
+@item
 There is no way to apply auto newline settings (@pxref{Auto-newlines})
 on already typed lines.  That's only a feature to ease interactive
 editing.
@@ -6747,6 +6761,25 @@
 it and font-locks it OK.  Templates used in expressions, and nested
 templates do not fare so well.  Sometimes a workaround is to refontify
 the expression after typing the closing @samp{>}.
+
+@item
+On loading @ccmode{}, sometimes this error message appears:
+
+@example
+File mode specification error: (void-variable c-font-lock-keywords-3)
+@end example
+
+This is due to a bug in the function @code{eval-after-load} in some
+versions of (X)Emacs.  It can manifest itself when there is a symbolic
+link in the path of the directory which contains (X)Emacs.  As a
+workaround, put the following into your @file{.emacs} file, fairly
+early on:
+
+@example
+(defun my-load-cc-fonts ()
+  (require "cc-fonts"))
+(add-hook 'c-initialization-hook 'my-load-cc-fonts)
+@end example
 @end itemize
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--- a/man/custom.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/custom.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -475,7 +475,7 @@
 This sets the variable to a previous value that was set in the
 customization buffer in this session.  If you customize a variable
 and then reset it, which discards the customized value,
-you can get the customized value back again with this operation.
+you can get the discarded value back again with this operation.
 @end table
 
 @cindex comments on customized settings
@@ -641,9 +641,9 @@
 @item M-x customize-saved
 Set up a customization buffer containing all settings that you
 have saved with customization buffers.
-@item M-x customize-customized
+@item M-x customize-unsaved
 Set up a customization buffer containing all settings that you have
-customized but not saved.
+set but not saved.
 @end table
 
 @findex customize-option
@@ -687,11 +687,11 @@
 loading them if necessary.
 
 @findex customize-saved
-@findex customize-customized
+@findex customize-unsaved
   If you change settings and then decide the change was a mistake, you
 can use two special commands to revisit your previous changes.  Use
 @kbd{M-x customize-saved} to look at the settings that you have saved.
-Use @kbd{M-x customize-customized} to look at the settings that you
+Use @kbd{M-x customize-unsaved} to look at the settings that you
 have set but not saved.
 
 @node Custom Themes
--- a/man/ebrowse.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/ebrowse.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -1275,7 +1275,7 @@
 by Ebrowse.
 
 @table @kbd
-@item C-c b f
+@item C-c C-m f
 Find the definition of the member around point.  If you invoke this
 function with a prefix argument, the declaration is searched.
 
@@ -1284,37 +1284,37 @@
 front of the member name, this class name is used as initial input for
 the completion.
 
-@item C-c b F
+@item C-c C-m F
 Find the declaration of the member around point.
 
-@item C-c b v
+@item C-c C-m v
 View the definition of the member around point.
 
-@item C-c b V
+@item C-c C-m V
 View the declaration of the member around point.
 
-@item C-c b 4 f
+@item C-c C-m 4 f
 Find a member's definition in another window.
 
-@item C-c b 4 F
+@item C-c C-m 4 F
 Find a member's declaration in another window.
 
-@item C-c b 4 v
+@item C-c C-m 4 v
 View a member's definition in another window.
 
-@item C-c b 4 V
+@item C-c C-m 4 V
 View a member's declaration in another window.
 
-@item C-c b 5 f
+@item C-c C-m 5 f
 Find a member's definition in another frame.
 
-@item C-c b 5 F
+@item C-c C-m 5 F
 Find a member's declaration in another frame.
 
-@item C-c b 5 v
+@item C-c C-m 5 v
 View a member's definition in another frame.
 
-@item C-c b 5 V
+@item C-c C-m 5 V
 View a member's declaration in another frame.
 @end table
 
@@ -1333,7 +1333,7 @@
 
 @table @kbd
 @cindex return to original position
-@item C-c b -
+@item C-c C-m -
 This command sets point to the previous position in the position stack.
 Directly after you performed a jump, this will put you back to the
 position where you came from.
@@ -1344,11 +1344,11 @@
 number is reached, older positions are discarded when new positions are
 pushed on the stack.
 
-@item C-c b +
+@item C-c C-m +
 This command moves forward in the position stack, setting point to
 the next position stored in the position stack.
 
-@item C-c b p
+@item C-c C-m p
 Displays an electric buffer showing all positions saved in the stack.
 You can select a position by pressing @kbd{SPC} in a line.  You can
 view a position with @kbd{v}.
@@ -1373,22 +1373,22 @@
 tree are used.
 
 @table @kbd
-@item C-c b s
+@item C-c C-m s
 This function performs a regular expression search in the chosen set of
 files.
 
-@item C-c b u
+@item C-c C-m u
 This command performs a search for calls of a given member which is
 selected in the usual way with completion.
 
-@item C-c b %
+@item C-c C-m %
 Perform a query replace over the set of files.
 
-@item C-c b ,
+@item C-c C-m ,
 All three operations above stop when finding a match.  You can restart
 the operation with this command.
 
-@item C-c b n
+@item C-c C-m n
 This restarts the last tags operation with the next file in the list.
 @end table
 
@@ -1403,7 +1403,7 @@
 @cindex list class members in a file
 @cindex file, members
 
-The command @kbd{C-c b l}, lists all members in a given file.  The file
+The command @kbd{C-c C-m l}, lists all members in a given file.  The file
 name is read from the minibuffer with completion.
 
 
@@ -1415,14 +1415,14 @@
 @cindex apropos on class members
 @cindex members, matching regexp
 
-The command @kbd{C-c b a} can be used to display all members matching a
+The command @kbd{C-c C-m a} can be used to display all members matching a
 given regular expression.  This command can be very useful if you
 remember only part of a member name, and not its beginning.
 
 A special buffer is popped up containing all identifiers matching the
 regular expression, and what kind of symbol it is (e.g.@: a member
 function, or a type).  You can then switch to this buffer, and use the
-command @kbd{C-c b f}, for example, to jump to a specific member.
+command @kbd{C-c C-m f}, for example, to jump to a specific member.
 
 
 
@@ -1433,7 +1433,7 @@
 @cindex completion
 @cindex symbol completion
 
-The command @kbd{C-c b @key{TAB}} completes the symbol in front of point.
+The command @kbd{C-c C-m @key{TAB}} completes the symbol in front of point.
 
 
 
@@ -1443,7 +1443,7 @@
 @cindex member buffer, for member at point
 
 You can quickly display a member buffer containing the member the cursor
-in on with the command @kbd{C-c b m}.
+in on with the command @kbd{C-c C-m m}.
 
 
 @node Concept Index, , Tags-like Functions, Top
--- a/man/entering.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/entering.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -39,12 +39,15 @@
 must start the editor again.  Working this way, it is convenient to
 use a command-line argument to say which file to edit.
 
-  It's not smart to start Emacs afresh for every file you edit.  Emacs
-can visit more than one file in a single editing session, and upon
-exit Emacs loses valuable accumulated context, such as the kill ring,
-registers, undo history, and mark ring.  These features are useful for
-operating on multiple files, or even one.  If you kill Emacs after
-each file, you don't take advantage of them.
+  However, killing Emacs after editing one each and starting it afresh
+for the next file is both unnecessary and harmful, since it denies you
+the full power of Emacs.  Emacs can visit more than one file in a
+single editing session, and that is the right way to use it.  Exiting
+the Emacs session loses valuable accumulated context, such as the kill
+ring, registers, undo history, and mark ring.  These features are
+useful for operating on multiple files, or even continuing to edit one
+file.  If you kill Emacs after each file, you don't take advantage of
+them.
 
   The recommended way to use GNU Emacs is to start it only once, just
 after you log in, and do all your editing in the same Emacs session.
--- a/man/erc.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/erc.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -274,6 +274,11 @@
 Once ERC is loaded, the command @kbd{M-x erc} will start ERC and
 prompt for the server to connect to.
 
+If the connection goes away at some point, ERC will try to reconnect
+automatically.  If it fails to reconnect, and you want to try to
+manually reestablish the connection at some later point, switch to an
+ERC buffer and run the /RECONNECT command.
+
 @c PRE5_2: Sample session, including:
 @c - connect to Freenode
 @c - /join #emacs
--- a/man/gnus.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/gnus.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -11217,72 +11217,100 @@
 type of the part.  This variable is ignored if the value of the
 controlling variable is a predicate list, as described above.
 
+@ifinfo
+@c Avoid sort of redundant entries in the same section for the printed
+@c manual, but add them in info to allow `i gnus-treat-foo-bar RET' or
+@c `i foo-bar'.
+@vindex gnus-treat-buttonize
+@vindex gnus-treat-buttonize-head
+@vindex gnus-treat-capitalize-sentences
+@vindex gnus-treat-overstrike
+@vindex gnus-treat-strip-cr
+@vindex gnus-treat-strip-headers-in-body
+@vindex gnus-treat-strip-leading-blank-lines
+@vindex gnus-treat-strip-multiple-blank-lines
+@vindex gnus-treat-strip-pem
+@vindex gnus-treat-strip-trailing-blank-lines
+@vindex gnus-treat-unsplit-urls
+@vindex gnus-treat-wash-html
+@vindex gnus-treat-date-english
+@vindex gnus-treat-date-iso8601
+@vindex gnus-treat-date-lapsed
+@vindex gnus-treat-date-local
+@vindex gnus-treat-date-original
+@vindex gnus-treat-date-user-defined
+@vindex gnus-treat-date-ut
+@vindex gnus-treat-from-picon
+@vindex gnus-treat-mail-picon
+@vindex gnus-treat-newsgroups-picon
+@vindex gnus-treat-display-smileys
+@vindex gnus-treat-body-boundary
+@vindex gnus-treat-display-x-face
+@vindex gnus-treat-display-face
+@vindex gnus-treat-emphasize
+@vindex gnus-treat-fill-article
+@vindex gnus-treat-fill-long-lines
+@vindex gnus-treat-hide-boring-headers
+@vindex gnus-treat-hide-citation
+@vindex gnus-treat-hide-citation-maybe
+@vindex gnus-treat-hide-headers
+@vindex gnus-treat-hide-signature
+@vindex gnus-treat-strip-banner
+@vindex gnus-treat-strip-list-identifiers
+@vindex gnus-treat-highlight-citation
+@vindex gnus-treat-highlight-headers
+@vindex gnus-treat-highlight-signature
+@vindex gnus-treat-play-sounds
+@vindex gnus-treat-translate
+@vindex gnus-treat-x-pgp-sig
+@vindex gnus-treat-unfold-headers
+@vindex gnus-treat-fold-headers
+@vindex gnus-treat-fold-newsgroups
+@vindex gnus-treat-leading-whitespace
+@end ifinfo
+
 The following treatment options are available.  The easiest way to
 customize this is to examine the @code{gnus-article-treat} customization
 group.  Values in parenthesis are suggested sensible values.  Others are
 possible but those listed are probably sufficient for most people.
 
 @table @code
-@vindex gnus-treat-buttonize
 @item gnus-treat-buttonize (t, integer)
-@vindex gnus-treat-buttonize-head
 @item gnus-treat-buttonize-head (head)
 
 @xref{Article Buttons}.
 
-@vindex gnus-treat-capitalize-sentences
 @item gnus-treat-capitalize-sentences (t, integer)
-@vindex gnus-treat-overstrike
 @item gnus-treat-overstrike (t, integer)
-@vindex gnus-treat-strip-cr
 @item gnus-treat-strip-cr (t, integer)
-@vindex gnus-treat-strip-headers-in-body
 @item gnus-treat-strip-headers-in-body (t, integer)
-@vindex gnus-treat-strip-leading-blank-lines
 @item gnus-treat-strip-leading-blank-lines (t, integer)
-@vindex gnus-treat-strip-multiple-blank-lines
 @item gnus-treat-strip-multiple-blank-lines (t, integer)
-@vindex gnus-treat-strip-pem
 @item gnus-treat-strip-pem (t, last, integer)
-@vindex gnus-treat-strip-trailing-blank-lines
 @item gnus-treat-strip-trailing-blank-lines (t, last, integer)
-@vindex gnus-treat-unsplit-urls
 @item gnus-treat-unsplit-urls (t, integer)
-@vindex gnus-treat-wash-html
 @item gnus-treat-wash-html (t, integer)
 
 @xref{Article Washing}.
 
-@vindex gnus-treat-date-english
 @item gnus-treat-date-english (head)
-@vindex gnus-treat-date-iso8601
 @item gnus-treat-date-iso8601 (head)
-@vindex gnus-treat-date-lapsed
 @item gnus-treat-date-lapsed (head)
-@vindex gnus-treat-date-local
 @item gnus-treat-date-local (head)
-@vindex gnus-treat-date-original
 @item gnus-treat-date-original (head)
-@vindex gnus-treat-date-user-defined
 @item gnus-treat-date-user-defined (head)
-@vindex gnus-treat-date-ut
 @item gnus-treat-date-ut (head)
 
 @xref{Article Date}.
 
-@vindex gnus-treat-from-picon
 @item gnus-treat-from-picon (head)
-@vindex gnus-treat-mail-picon
 @item gnus-treat-mail-picon (head)
-@vindex gnus-treat-newsgroups-picon
 @item gnus-treat-newsgroups-picon (head)
 
 @xref{Picons}.
 
-@vindex gnus-treat-display-smileys
 @item gnus-treat-display-smileys (t, integer)
 
-@vindex gnus-treat-body-boundary
 @item gnus-treat-body-boundary (head)
 
 @vindex gnus-body-boundary-delimiter
--- a/man/message.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/message.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -889,11 +889,21 @@
 Using the @acronym{MML} language, Message is able to create digitally
 signed and digitally encrypted messages.  Message (or rather
 @acronym{MML}) currently support @acronym{PGP} (RFC 1991),
-@acronym{PGP/MIME} (RFC 2015/3156) and @acronym{S/MIME}.  Instructing
-@acronym{MML} to perform security operations on a @acronym{MIME} part is
-done using the @kbd{C-c C-m s} key map for signing and the @kbd{C-c C-m
-c} key map for encryption, as follows.
-
+@acronym{PGP/MIME} (RFC 2015/3156) and @acronym{S/MIME}.
+
+@menu
+* Signing and encryption::      Signing and encrypting commands.
+* Using S/MIME::                Using S/MIME
+* Using PGP/MIME::              Using PGP/MIME
+* PGP Compatibility::           Compatibility with older implementations
+@end menu
+
+@node Signing and encryption
+@subsection Signing and encrypting commands
+
+Instructing @acronym{MML} to perform security operations on a
+@acronym{MIME} part is done using the @kbd{C-c C-m s} key map for
+signing and the @kbd{C-c C-m c} key map for encryption, as follows.
 @table @kbd
 
 @item C-c C-m s s
@@ -976,6 +986,7 @@
 other properly.  Thus, we now describe what external libraries or
 programs are required to make things work, and some small general hints.
 
+@node Using S/MIME
 @subsection Using S/MIME
 
 @emph{Note!}  This section assume you have a basic familiarity with
@@ -1038,6 +1049,7 @@
 you are on a secure single user machine) simply press @code{RET} at
 the passphrase prompt.
 
+@node Using PGP/MIME
 @subsection Using PGP/MIME
 
 @acronym{PGP/MIME} requires an external OpenPGP implementation, such
@@ -1045,7 +1057,48 @@
 implementations such as PGP 2.x and PGP 5.x are also supported.  One
 Emacs interface to the PGP implementations, PGG (@pxref{Top, ,PGG,
 pgg, PGG Manual}), is included, but Mailcrypt and Florian Weimer's
-@code{gpg.el} are also supported.
+@code{gpg.el} are also supported.  @xref{PGP Compatibility}.
+
+@cindex gpg-agent
+Message internally calls GnuPG (the @command{gpg} command) to perform
+data encryption, and in certain cases (decrypting or signing for
+example), @command{gpg} requires user's passphrase.  Currently the
+recommended way to supply your passphrase to @command{gpg} is to use the
+@command{gpg-agent} program.
+
+To use @command{gpg-agent} in Emacs, you need to run the following
+command from the shell before starting Emacs.
+
+@example
+eval `gpg-agent --daemon`
+@end example
+
+This will invoke @command{gpg-agent} and set the environment variable
+@code{GPG_AGENT_INFO} to allow @command{gpg} to communicate with it.
+It might be good idea to put this command in your @file{.xsession} or
+@file{.bash_profile}.  @xref{Invoking GPG-AGENT, , , gnupg, Using the
+GNU Privacy Guard}.
+
+Once your @command{gpg-agent} is set up, it will ask you for a
+passphrase as needed for @command{gpg}.  Under the X Window System,
+you will see a new passphrase input dialog appear.  The dialog is
+provided by PIN Entry (the @command{pinentry} command), and as of
+version 0.7.2, @command{pinentry} cannot cooperate with Emacs on a
+single tty.  So, if you are using a text console, you may need to put
+a passphrase into gpg-agent's cache beforehand.  The following command
+does the trick.
+
+@example
+gpg --use-agent --sign < /dev/null > /dev/null
+@end example
+
+The Lisp variable @code{pgg-gpg-use-agent} controls whether to use
+@command{gpg-agent}.  See also @xref{Caching passphrase, , , pgg, The
+PGG Manual}.
+
+
+@node PGP Compatibility
+@subsection Compatibility with older implementations
 
 @vindex gpg-temp-directory
 Note, if you are using the @code{gpg.el} you must make sure that the
--- a/man/misc.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/misc.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -983,8 +983,8 @@
 
 @vindex comint-scroll-show-maximum-output
   If @code{comint-scroll-show-maximum-output} is non-@code{nil}, then
-arrival of output when point is at the end tries to place the last line of
-text at the bottom line of the window, so as to show as much useful
+arrival of output when point is at the end tries to scroll the last
+line of text to the bottom line of the window, showing as much useful
 text as possible.  (This mimics the scrolling behavior of most
 terminals.)  The default is @code{t}.
 
--- a/man/msdog.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/msdog.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -334,11 +334,14 @@
 keyboard input in Emacs.
 
 @cindex MS-Windows keyboard shortcuts
-  Many key combinations (known as ``keyboard shortcuts'') that are in
-widespread use in MS-Windows programs are taken by various Emacs
-features.  Examples include @kbd{C-C}, @kbd{C-X}, @kbd{C-Z},
-@kbd{C-A}, and @kbd{W-SPC}.  You can get some of them back by turning
-on CUA Mode (@pxref{CUA Bindings}).
+  Many key combinations (known as ``keyboard shortcuts'') that have
+conventional uses in MS-Windows programs conflict with traditional
+Emacs commands.  This conflict arose because the designers of the CUA
+interface implemented by MS-Windows did not try to avoid conflict with
+Emacs.  Examples of conflicts include @kbd{C-c}, @kbd{C-x}, @kbd{C-z},
+@kbd{C-a}, and @kbd{W-@key{SPC}}.  You can redefine some of them with
+meanings more like the MS-Windows meanings by enabling CUA Mode
+(@pxref{CUA Bindings}).
 
 @kindex F10 @r{(MS-Windows)}
 @cindex menu bar access using keyboard @r{(MS-Windows)}
--- a/man/programs.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/programs.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -1330,9 +1330,12 @@
   The character @kbd{M-@key{TAB}} runs a command to complete the
 partial symbol before point against the set of meaningful symbol
 names.  This command inserts at point any additional characters that
-it can determine from the partial name.  (If your window manager
-defines @kbd{M-@key{TAB}} to switch windows, you can type
-@kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}.)
+it can determine from the partial name.
+
+  If your window manager defines @kbd{M-@key{TAB}} to switch windows,
+you can type @kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i} instead.
+However, most window managers let you customize these shortcuts, and
+we recommend that you change any that get in the way of use of Emacs.
 
   If the partial name in the buffer has multiple possible completions
 that differ in the very next character, so that it is impossible to
--- a/man/xresources.texi	Mon Jan 01 18:32:06 2007 +0000
+++ b/man/xresources.texi	Sat Jan 06 15:25:16 2007 +0000
@@ -62,7 +62,7 @@
 Emacs compiled for Windows looks for X resources in the Windows
 Registry, under the key @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}
 and then under the key @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}.
-The menu and scrollbars are native widgets on MS-Windows, so they are
+The menu and scroll bars are native widgets on MS-Windows, so they are
 only customizable via the system-wide settings in the Display Control
 Panel.  You can also set resources using the @samp{-xrm} command line
 option (see below.)
@@ -294,6 +294,11 @@
 Gamma correction for colors, equivalent to the frame parameter
 @code{screen-gamma}.
 
+@item @code{scrollBarWidth} (class @code{ScrollBarWidth})
+@cindex scrollbar width
+The scroll bar width in pixels, equivalent to the frame parameter
+@code{scroll-bar-width}.
+
 @ifnottex
 @item @code{selectionFont} (class @code{SelectionFont})
 Font name for pop-up menu items, in non-toolkit versions of Emacs.  (For
--- a/oldXMenu/insque.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/oldXMenu/insque.c	Sat Jan 06 15:25:16 2007 +0000
@@ -1,8 +1,23 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005,
-                 2006 Free Software Foundation, Inc.  */
+/* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003,
+                 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 /* This file implements the emacs_insque and emacs_remque functions,
-   copies of the insque and remque functions of BSD.  They and all
+   clones of the insque and remque functions of BSD.  They and all
    their callers have been renamed to emacs_mumble to allow us to
    include this file in the menu library on all systems.  */
 
--- a/src/ChangeLog	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/ChangeLog	Sat Jan 06 15:25:16 2007 +0000
@@ -1,3 +1,76 @@
+2007-01-05  Kim F. Storm  <storm@cua.dk>
+
+	* indent.c (Fvertical_motion): Fix it overshoot check for overlay
+	strings without embedded newlines immediately followed by newline.
+
+2007-01-05  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* editfns.c (Fformat_time_string, Fdecode_time, Fencode_time)
+	(Fcurrent_time_string, Fcurrent_time_zone): Add BLOCK_INPUT around
+	gmtime/localtime/emacs_memftimeu/mktime.
+
+	* mac.c (Fmac_set_file_creator): Use MAC_EMACS_CREATOR_CODE
+	instead of 'EMAx'.
+	[!MAC_OSX] (sys_open, sys_creat, sys_fopen): Likewise.
+
+	* macgui.h (struct _XGC) [USE_CG_DRAWING
+	&& MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: New members cg_fore_color
+	and cg_back_color.
+
+	* macmenu.c (Vshow_help_function) [TARGET_API_MAC_CARBON]: Add extern.
+	(restore_show_help_function, menu_target_item_handler)
+	[TARGET_API_MAC_CARBON]: New functions.
+	(install_menu_target_item_handler): New function.
+	(add_menu_item) [TARGET_API_MAC_CARBON]: Set help string as menu
+	item property.
+
+	* macterm.c (CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR)
+	(CG_SET_FILL_COLOR_WITH_GC_FOREGROUND)
+	(CG_SET_FILL_COLOR_WITH_GC_BACKGROUND)
+	(CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR)
+	(CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND): New macros.
+	(mac_cg_color_space_rgb) [USE_CG_DRAWING]: New variable.
+	(mac_cg_color_black) [USE_CG_DRAWING
+	&& MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: New variable.
+	(init_cg_color) [USE_CG_DRAWING]: New function.
+	(mac_draw_line, mac_draw_rectangle) [USE_CG_DRAWING]: Use
+	CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND instead of CG_SET_STROKE_COLOR.
+	(mac_erase_rectangle, mac_clear_window, mac_draw_cg_image)
+	(mac_fill_rectangle, mac_draw_image_string_cg) [USE_CG_DRAWING]:
+	Use CG_SET_FILL_COLOR_WITH_GC_FOREGROUND or
+	CG_SET_FILL_COLOR_WITH_GC_BACKGROUND instead of CG_SET_FILL_COLOR.
+	(mac_draw_string_common) [MAC_OSX && USE_ATSUI]: Likewise.
+	(XCreateGC, XFreeGC, XSetForeground, XSetBackground) [USE_CG_DRAWING
+	&& MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: Use gc->cg_fore_color	and/or
+	gc->cg_back_color.
+	(install_drag_handler, remove_drag_handler): Make extern.
+	(install_menu_target_item_handler): Add extern.
+	(install_window_handler): Call install_menu_target_item_handler.
+	[MAC_OS8] (main): Use MAC_EMACS_CREATOR_CODE instead of 'EMAx'.
+	(mac_initialize) [USE_CG_DRAWING]: Call init_cg_color.
+
+	* macterm.h (MAC_EMACS_CREATOR_CODE): New enumerator.
+
+2007-01-04  Juanma Barranquero  <lekktu@gmail.com>
+
+	* window.c (Fwindow_end): Fix use of >= operator.
+
+2007-01-03  Richard Stallman  <rms@gnu.org>
+
+	* window.c (Fwindow_end): Check BUF_OVERLAY_MODIFF like BUF_MODIFF.
+
+2007-01-02  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gtkutil.h (xg_menu_item_cb_data_): Remove highlight_id and
+	unhighlight_id.
+
+	* gtkutil.c (menuitem_highlight_callback): Invoked widget is the
+	parent of the menu item.  Get menu item widget from event.
+	(xg_create_one_menuitem, xg_update_menu_item): highlight_id and
+	unhighlight_id has been removed.
+	(create_menus): Connect enter/leave-notify-event to the menu instead
+	of individual items.
+
 2006-12-31  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (update_frame_tool_bar): Connect create-menu-proxy with
--- a/src/editfns.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/editfns.c	Sat Jan 06 15:25:16 2007 +0000
@@ -1678,7 +1678,9 @@
   /* This is probably enough.  */
   size = SBYTES (format_string) * 6 + 50;
 
+  BLOCK_INPUT;
   tm = ut ? gmtime (&value) : localtime (&value);
+  UNBLOCK_INPUT;
   if (! tm)
     error ("Specified time is not representable");
 
@@ -1690,18 +1692,22 @@
       int result;
 
       buf[0] = '\1';
+      BLOCK_INPUT;
       result = emacs_memftimeu (buf, size, SDATA (format_string),
 				SBYTES (format_string),
 				tm, ut);
+      UNBLOCK_INPUT;
       if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
 	return code_convert_string_norecord (make_unibyte_string (buf, result),
 					     Vlocale_coding_system, 0);
 
       /* If buffer was too small, make it bigger and try again.  */
+      BLOCK_INPUT;
       result = emacs_memftimeu (NULL, (size_t) -1,
 				SDATA (format_string),
 				SBYTES (format_string),
 				tm, ut);
+      UNBLOCK_INPUT;
       size = result + 1;
     }
 }
@@ -1732,7 +1738,9 @@
   if (! lisp_time_argument (specified_time, &time_spec, NULL))
     error ("Invalid time specification");
 
+  BLOCK_INPUT;
   decoded_time = localtime (&time_spec);
+  UNBLOCK_INPUT;
   if (! decoded_time)
     error ("Specified time is not representable");
   XSETFASTINT (list_args[0], decoded_time->tm_sec);
@@ -1748,7 +1756,9 @@
 
   /* Make a copy, in case gmtime modifies the struct.  */
   save_tm = *decoded_time;
+  BLOCK_INPUT;
   decoded_time = gmtime (&time_spec);
+  UNBLOCK_INPUT;
   if (decoded_time == 0)
     list_args[8] = Qnil;
   else
@@ -1804,7 +1814,11 @@
   if (CONSP (zone))
     zone = Fcar (zone);
   if (NILP (zone))
-    time = mktime (&tm);
+    {
+      BLOCK_INPUT;
+      time = mktime (&tm);
+      UNBLOCK_INPUT;
+    }
   else
     {
       char tzbuf[100];
@@ -1829,7 +1843,9 @@
 	 value doesn't suffice, since that would mishandle leap seconds.  */
       set_time_zone_rule (tzstring);
 
+      BLOCK_INPUT;
       time = mktime (&tm);
+      UNBLOCK_INPUT;
 
       /* Restore TZ to previous value.  */
       newenv = environ;
@@ -1873,7 +1889,9 @@
   /* Convert to a string, checking for out-of-range time stamps.
      Don't use 'ctime', as that might dump core if VALUE is out of
      range.  */
+  BLOCK_INPUT;
   tm = localtime (&value);
+  UNBLOCK_INPUT;
   if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm))))
     error ("Specified time is not representable");
 
@@ -1929,9 +1947,21 @@
   struct tm *t;
   struct tm gmt;
 
-  if (lisp_time_argument (specified_time, &value, NULL)
-      && (t = gmtime (&value)) != 0
-      && (gmt = *t, t = localtime (&value)) != 0)
+  if (!lisp_time_argument (specified_time, &value, NULL))
+    t = NULL;
+  else
+    {
+      BLOCK_INPUT;
+      t = gmtime (&value);
+      if (t)
+	{
+	  gmt = *t;
+	  t = localtime (&value);
+	}
+      UNBLOCK_INPUT;
+    }
+
+  if (t)
     {
       int offset = tm_diff (t, &gmt);
       char *s = 0;
--- a/src/gtkutil.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/gtkutil.c	Sat Jan 06 15:25:16 2007 +0000
@@ -1718,9 +1718,9 @@
 }
 
 /* Callback called when the pointer enters/leaves a menu item.
-   W is the menu item.
+   W is the parent of the menu item.
    EVENT is either an enter event or leave event.
-   CLIENT_DATA points to the xg_menu_item_cb_data associated with the W.
+   CLIENT_DATA is not used.
 
    Returns FALSE to tell GTK to keep processing this event.  */
 
@@ -1730,15 +1730,21 @@
      GdkEventCrossing *event;
      gpointer client_data;
 {
-  if (client_data)
+  GdkEvent ev;
+  GtkWidget *subwidget;
+  xg_menu_item_cb_data *data;
+
+  ev.crossing = *event;
+  subwidget = gtk_get_event_widget (&ev);
+  data = (xg_menu_item_cb_data *) g_object_get_data (G_OBJECT (subwidget),
+                                                     XG_ITEM_DATA);
+  if (data)
     {
-      xg_menu_item_cb_data *data = (xg_menu_item_cb_data*) client_data;
-      gpointer call_data = event->type == GDK_LEAVE_NOTIFY ? 0 : client_data;
-
       if (! NILP (data->help) && data->cl_data->highlight_cb)
         {
+          gpointer call_data = event->type == GDK_LEAVE_NOTIFY ? 0 : data;
           GtkCallback func = (GtkCallback) data->cl_data->highlight_cb;
-          (*func) (w, call_data);
+          (*func) (subwidget, call_data);
         }
     }
 
@@ -2004,7 +2010,7 @@
 
   xg_list_insert (&xg_menu_item_cb_list, &cb_data->ptrs);
 
-  cb_data->unhighlight_id = cb_data->highlight_id = cb_data->select_id = 0;
+  cb_data->select_id = 0;
   cb_data->help = item->help;
   cb_data->cl_data = cl_data;
   cb_data->call_data = item->call_data;
@@ -2025,22 +2031,6 @@
           = g_signal_connect (G_OBJECT (w), "activate", select_cb, cb_data);
     }
 
-  if (! NILP (item->help) && highlight_cb)
-    {
-      /* We use enter/leave notify instead of select/deselect because
-         select/deselect doesn't go well with detached menus.  */
-      cb_data->highlight_id
-        = g_signal_connect (G_OBJECT (w),
-                            "enter-notify-event",
-                            G_CALLBACK (menuitem_highlight_callback),
-                            cb_data);
-      cb_data->unhighlight_id
-        = g_signal_connect (G_OBJECT (w),
-                            "leave-notify-event",
-                            G_CALLBACK (menuitem_highlight_callback),
-                            cb_data);
-    }
-
   return w;
 }
 
@@ -2123,6 +2113,17 @@
       {
         wmenu = gtk_menu_new ();
         xg_set_screen (wmenu, f);
+        /* Connect this to the menu instead of items so we get enter/leave for
+           disabled items also.  TODO:  Still does not get enter/leave for
+           disabled items in detached menus.  */
+        g_signal_connect (G_OBJECT (wmenu),
+                          "enter-notify-event",
+                          G_CALLBACK (menuitem_highlight_callback),
+                          NULL);
+        g_signal_connect (G_OBJECT (wmenu),
+                          "leave-notify-event",
+                          G_CALLBACK (menuitem_highlight_callback),
+                          NULL);
       }
       else wmenu = gtk_menu_bar_new ();
 
@@ -2619,37 +2620,6 @@
           g_signal_handler_disconnect (w, cb_data->select_id);
           cb_data->select_id = 0;
         }
-
-      if (NILP (cb_data->help))
-        {
-          /* Shall not have help.  Remove if any existed previously.  */
-          if (cb_data->highlight_id)
-            {
-              g_signal_handler_disconnect (G_OBJECT (w),
-                                           cb_data->highlight_id);
-              cb_data->highlight_id = 0;
-            }
-          if (cb_data->unhighlight_id)
-            {
-              g_signal_handler_disconnect (G_OBJECT (w),
-                                           cb_data->unhighlight_id);
-              cb_data->unhighlight_id = 0;
-            }
-        }
-      else if (! cb_data->highlight_id && highlight_cb)
-        {
-          /* Have help now, but didn't previously.  Add callback.  */
-          cb_data->highlight_id
-            = g_signal_connect (G_OBJECT (w),
-                                "enter-notify-event",
-                                G_CALLBACK (menuitem_highlight_callback),
-                                cb_data);
-          cb_data->unhighlight_id
-            = g_signal_connect (G_OBJECT (w),
-                                "leave-notify-event",
-                                G_CALLBACK (menuitem_highlight_callback),
-                                cb_data);
-        }
     }
 }
 
--- a/src/gtkutil.h	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/gtkutil.h	Sat Jan 06 15:25:16 2007 +0000
@@ -79,8 +79,6 @@
 {
   xg_list_node  ptrs;
 
-  gulong        highlight_id;
-  gulong        unhighlight_id;
   gulong        select_id;
   Lisp_Object   help;
   gpointer	call_data;
--- a/src/indent.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/indent.c	Sat Jan 06 15:25:16 2007 +0000
@@ -2076,7 +2076,7 @@
     {
       int it_start;
       int oselective;
-      int it_overshoot_expected_p;
+      int it_overshoot_expected;
 
       SET_TEXT_POS (pt, PT, PT_BYTE);
       start_display (&it, w, pt);
@@ -2102,12 +2102,16 @@
 	  while (s < e && *s != '\n')
 	    ++s;
 
-	  it_overshoot_expected_p = (s == e);
+	  /* If there is no newline in the string, we need to check
+	     whether there is a newline immediately after the string
+	     in move_it_to below.  This may happen if there is an
+	     overlay with an after-string just before the newline.  */
+	  it_overshoot_expected = (s == e) ? -1 : 0;
 	}
       else
-	it_overshoot_expected_p = (it.method == GET_FROM_IMAGE
-				   || it.method == GET_FROM_STRETCH
-				   || it.method == GET_FROM_COMPOSITION);
+	it_overshoot_expected = (it.method == GET_FROM_IMAGE
+				 || it.method == GET_FROM_STRETCH
+				 || it.method == GET_FROM_COMPOSITION);
 
       reseat_at_previous_visible_line_start (&it);
       it.current_x = it.hpos = 0;
@@ -2121,7 +2125,10 @@
 	 truncate-lines is on and PT is beyond right margin.
 	 Don't go back if the overshoot is expected (see above).  */
       if (IT_CHARPOS (it) > it_start && XINT (lines) > 0
-	  && !it_overshoot_expected_p)
+	  && (!it_overshoot_expected
+	      || (it_overshoot_expected < 0
+		  && it.method == GET_FROM_BUFFER
+		  && it.c == '\n')))
 	move_it_by_lines (&it, -1, 0);
 
       it.vpos = 0;
--- a/src/mac.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/mac.c	Sat Jan 06 15:25:16 2007 +0000
@@ -2261,7 +2261,7 @@
       int res = open (mac_pathname, oflag);
       /* if (oflag == O_WRONLY || oflag == O_RDWR) */
       if (oflag & O_CREAT)
-        fsetfileinfo (mac_pathname, 'EMAx', 'TEXT');
+        fsetfileinfo (mac_pathname, MAC_EMACS_CREATOR_CODE, 'TEXT');
       return res;
 #else /* not __MRC__ */
       return open (mac_pathname, oflag);
@@ -2287,7 +2287,7 @@
     {
 #ifdef __MRC__
       int result = creat (mac_pathname);
-      fsetfileinfo (mac_pathname, 'EMAx', 'TEXT');
+      fsetfileinfo (mac_pathname, MAC_EMACS_CREATOR_CODE, 'TEXT');
       return result;
 #else /* not __MRC__ */
       return creat (mac_pathname, mode);
@@ -2415,7 +2415,7 @@
     {
 #ifdef __MRC__
       if (mode[0] == 'w' || mode[0] == 'a')
-        fsetfileinfo (mac_pathname, 'EMAx', 'TEXT');
+        fsetfileinfo (mac_pathname, MAC_EMACS_CREATOR_CODE, 'TEXT');
 #endif /* not __MRC__ */
       return fopen (mac_pathname, mode);
     }
@@ -4316,7 +4316,7 @@
   OSType cCode;
   CHECK_STRING (filename);
 
-  cCode = mac_get_code_from_arg(code, 'EMAx');
+  cCode = mac_get_code_from_arg(code, MAC_EMACS_CREATOR_CODE);
 
   if (NILP(Ffile_exists_p(filename)) || !NILP(Ffile_directory_p(filename))) {
     return Qnil;
--- a/src/macgui.h	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/macgui.h	Sat Jan 06 15:25:16 2007 +0000
@@ -244,6 +244,14 @@
   /* QuickDraw background color.  */
   RGBColor back_color;
 
+#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+  /* Quartz 2D foreground color.  */
+  CGColorRef cg_fore_color;
+
+  /* Quartz 2D background color.  */
+  CGColorRef cg_back_color;
+#endif
+
 #define MAX_CLIP_RECTS 2
   /* Number of clipping rectangles.  */
   int n_clip_rects;
--- a/src/macmenu.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/macmenu.c	Sat Jan 06 15:25:16 2007 +0000
@@ -1450,6 +1450,80 @@
 }
 
 
+#if TARGET_API_MAC_CARBON
+extern Lisp_Object Vshow_help_function;
+
+static Lisp_Object
+restore_show_help_function (old_show_help_function)
+     Lisp_Object old_show_help_function;
+{
+  Vshow_help_function = old_show_help_function;
+
+  return Qnil;
+}
+
+static pascal OSStatus
+menu_target_item_handler (next_handler, event, data)
+     EventHandlerCallRef next_handler;
+     EventRef event;
+     void *data;
+{
+  OSStatus err, result;
+  MenuRef menu;
+  MenuItemIndex menu_item;
+  Lisp_Object help;
+  GrafPtr port;
+  int specpdl_count = SPECPDL_INDEX ();
+
+  result = CallNextEventHandler (next_handler, event);
+
+  err = GetEventParameter (event, kEventParamDirectObject, typeMenuRef,
+			   NULL, sizeof (MenuRef), NULL, &menu);
+  if (err == noErr)
+    err = GetEventParameter (event, kEventParamMenuItemIndex,
+			     typeMenuItemIndex, NULL,
+			     sizeof (MenuItemIndex), NULL, &menu_item);
+  if (err == noErr)
+    err = GetMenuItemProperty (menu, menu_item,
+			       MAC_EMACS_CREATOR_CODE, 'help',
+			       sizeof (Lisp_Object), NULL, &help);
+  if (err != noErr)
+    help = Qnil;
+
+  /* Temporarily bind Vshow_help_function to Qnil because we don't
+     want tooltips during menu tracking.  */
+  record_unwind_protect (restore_show_help_function, Vshow_help_function);
+  Vshow_help_function = Qnil;
+  GetPort (&port);
+  show_help_echo (help, Qnil, Qnil, Qnil, 1);
+  SetPort (port);
+  unbind_to (specpdl_count, Qnil);
+
+  return err == noErr ? noErr : result;
+}
+#endif
+
+OSStatus
+install_menu_target_item_handler (window)
+     WindowPtr window;
+{
+  OSStatus err = noErr;
+#if TARGET_API_MAC_CARBON
+  static const EventTypeSpec specs[] =
+    {{kEventClassMenu, kEventMenuTargetItem}};
+  static EventHandlerUPP menu_target_item_handlerUPP = NULL;
+
+  if (menu_target_item_handlerUPP == NULL)
+    menu_target_item_handlerUPP =
+      NewEventHandlerUPP (menu_target_item_handler);
+
+  err = InstallWindowEventHandler (window, menu_target_item_handlerUPP,
+				   GetEventTypeCount (specs), specs,
+				   NULL, NULL);
+#endif
+  return err;
+}
+
 /* Event handler function that pops down a menu on C-g.  We can only pop
    down menus if CancelMenuTracking is present (OSX 10.3 or later).  */
 
@@ -2485,6 +2559,10 @@
         EnableMenuItem (menu, pos);
       else
         DisableMenuItem (menu, pos);
+
+      if (STRINGP (wv->help))
+	SetMenuItemProperty (menu, pos, MAC_EMACS_CREATOR_CODE, 'help',
+			     sizeof (Lisp_Object), &wv->help);
 #else  /* ! TARGET_API_MAC_CARBON */
       item_name[sizeof (item_name) - 1] = '\0';
       strncpy (item_name, wv->name, sizeof (item_name) - 1);
--- a/src/macterm.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/macterm.c	Sat Jan 06 15:25:16 2007 +0000
@@ -270,16 +270,63 @@
 #define GC_BACK_COLOR(gc)	(&(gc)->back_color)
 #define GC_FONT(gc)		((gc)->xgcv.font)
 #define FRAME_NORMAL_GC(f)	((f)->output_data.mac->normal_gc)
-#define CG_SET_FILL_COLOR(context, color)			\
+
+#define CG_SET_FILL_COLOR(context, color)				\
   CGContextSetRGBFillColor (context,					\
 			    RED_FROM_ULONG (color) / 255.0f,		\
 			    GREEN_FROM_ULONG (color) / 255.0f,		\
 			    BLUE_FROM_ULONG (color) / 255.0f, 1.0f)
-#define CG_SET_STROKE_COLOR(context, color)		\
+#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+#define CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \
+  do {								       \
+    if (CGColorGetTypeID != NULL)				       \
+      CGContextSetFillColorWithColor (context, cg_color);	       \
+    else							       \
+      CG_SET_FILL_COLOR (context, color);			       \
+  } while (0)
+#else
+#define CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color)	\
+  CGContextSetFillColorWithColor (context, cg_color)
+#endif
+#else
+#define CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color)	\
+  CG_SET_FILL_COLOR (context, color)
+#endif
+#define CG_SET_FILL_COLOR_WITH_GC_FOREGROUND(context, gc)		\
+  CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR (context, (gc)->xgcv.foreground,	\
+					(gc)->cg_fore_color)
+#define CG_SET_FILL_COLOR_WITH_GC_BACKGROUND(context, gc)		\
+  CG_SET_FILL_COLOR_MAYBE_WITH_CGCOLOR (context, (gc)->xgcv.background,	\
+					(gc)->cg_back_color)
+
+
+#define CG_SET_STROKE_COLOR(context, color)				\
   CGContextSetRGBStrokeColor (context,					\
 			      RED_FROM_ULONG (color) / 255.0f,		\
 			      GREEN_FROM_ULONG (color) / 255.0f,	\
 			      BLUE_FROM_ULONG (color) / 255.0f, 1.0f)
+#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+#define CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \
+  do {								       \
+    if (CGColorGetTypeID != NULL)				       \
+      CGContextSetStrokeColorWithColor (context, cg_color);	       \
+    else							       \
+      CG_SET_STROKE_COLOR (context, color);			       \
+  } while (0)
+#else
+#define CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \
+  CGContextSetStrokeColorWithColor (context, cg_color)
+#endif
+#else
+#define CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR(context, color, cg_color) \
+  CG_SET_STROKE_COLOR (context, color)
+#endif
+#define CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND(context, gc) \
+  CG_SET_STROKE_COLOR_MAYBE_WITH_CGCOLOR (context, (gc)->xgcv.foreground, \
+					  (gc)->cg_fore_color)
+
 #if USE_CG_DRAWING
 #define FRAME_CG_CONTEXT(f)	((f)->output_data.mac->cg_context)
 
@@ -288,6 +335,29 @@
 static int max_fringe_bmp = 0;
 static CGImageRef *fringe_bmp = 0;
 
+static CGColorSpaceRef mac_cg_color_space_rgb;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+static CGColorRef mac_cg_color_black;
+#endif
+
+static void
+init_cg_color ()
+{
+  mac_cg_color_space_rgb = CGColorSpaceCreateDeviceRGB ();
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+  /* Don't check the availability of CGColorCreate; this symbol is
+     defined even in Mac OS X 10.1.  */
+  if (CGColorGetTypeID != NULL)
+#endif
+    {
+      float rgba[] = {0.0f, 0.0f, 0.0f, 1.0f};
+
+      mac_cg_color_black = CGColorCreate (mac_cg_color_space_rgb, rgba);
+    }
+#endif
+}
+
 static CGContextRef
 mac_begin_cg_clip (f, gc)
      struct frame *f;
@@ -401,7 +471,7 @@
     gy1 += 0.5f, gy2 += 0.5f;
 
   context = mac_begin_cg_clip (f, gc);
-  CG_SET_STROKE_COLOR (context, gc->xgcv.foreground);
+  CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND (context, gc);
   CGContextBeginPath (context);
   CGContextMoveToPoint (context, gx1, gy1);
   CGContextAddLineToPoint (context, gx2, gy2);
@@ -485,7 +555,7 @@
   CGContextRef context;
 
   context = mac_begin_cg_clip (f, gc);
-  CG_SET_FILL_COLOR (context, gc->xgcv.background);
+  CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
   CGContextFillRect (context, CGRectMake (x, y, width, height));
   mac_end_cg_clip (f);
 #else
@@ -527,7 +597,7 @@
   GC gc = FRAME_NORMAL_GC (f);
 
   context = mac_begin_cg_clip (f, NULL);
-  CG_SET_FILL_COLOR (context, gc->xgcv.background);
+  CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
   CGContextFillRect (context, CGRectMake (0, 0, FRAME_PIXEL_WIDTH (f),
 					  FRAME_PIXEL_HEIGHT (f)));
   mac_end_cg_clip (f);
@@ -570,14 +640,14 @@
   context = mac_begin_cg_clip (f, gc);
   if (!overlay_p)
     {
-      CG_SET_FILL_COLOR (context, gc->xgcv.background);
+      CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
       CGContextFillRect (context, dest_rect);
     }
   CGContextClipToRect (context, dest_rect);
   CGContextScaleCTM (context, 1, -1);
   CGContextTranslateCTM (context, 0, -port_height);
   if (CGImageIsMask (image))
-    CG_SET_FILL_COLOR (context, gc->xgcv.foreground);
+    CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc);
   CGContextDrawImage (context,
 		      CGRectMake (dest_x - src_x,
 				  port_height - (dest_y - src_y
@@ -764,7 +834,7 @@
   CGContextRef context;
 
   context = mac_begin_cg_clip (f, gc);
-  CG_SET_FILL_COLOR (context, gc->xgcv.foreground);
+  CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc);
   CGContextFillRect (context, CGRectMake (x, y, width, height));
   mac_end_cg_clip (f);
 #else
@@ -795,7 +865,7 @@
   CGContextRef context;
 
   context = mac_begin_cg_clip (f, gc);
-  CG_SET_STROKE_COLOR (context, gc->xgcv.foreground);
+  CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND (context, gc);
   CGContextStrokeRect (context,
 		       CGRectMake (x + 0.5f, y + 0.5f, width, height));
   mac_end_cg_clip (f);
@@ -982,7 +1052,7 @@
 #endif
 	      if (bg_width)
 		{
-		  CG_SET_FILL_COLOR (context, gc->xgcv.background);
+		  CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
 		  CGContextFillRect
 		    (context,
 		     CGRectMake (x, y - FONT_BASE (GC_FONT (gc)),
@@ -993,7 +1063,7 @@
 #if !USE_CG_DRAWING
 	    }
 #endif
-	  CG_SET_FILL_COLOR (context, gc->xgcv.foreground);
+	  CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc);
 	  err = ATSUSetLayoutControls (text_layout,
 				       sizeof (tags) / sizeof (tags[0]),
 				       tags, sizes, values);
@@ -1344,7 +1414,7 @@
 #endif
       if (bg_width)
 	{
-	  CG_SET_FILL_COLOR (context, gc->xgcv.background);
+	  CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
 	  CGContextFillRect
 	    (context,
 	     CGRectMake (gx, y - FONT_BASE (GC_FONT (gc)),
@@ -1355,7 +1425,7 @@
 #if !USE_CG_DRAWING
     }
 #endif
-  CG_SET_FILL_COLOR (context, gc->xgcv.foreground);
+  CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc);
   CGContextSetFont (context, GC_FONT (gc)->cg_font);
   CGContextSetFontSize (context, GC_FONT (gc)->mac_fontsize);
   if (GC_FONT (gc)->mac_fontsize <= cg_text_anti_aliasing_threshold)
@@ -1567,6 +1637,16 @@
   GC gc = xmalloc (sizeof (*gc));
 
   bzero (gc, sizeof (*gc));
+#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+  if (CGColorGetTypeID != NULL)
+#endif
+    {
+      gc->cg_fore_color = gc->cg_back_color = mac_cg_color_black;
+      CGColorRetain (gc->cg_fore_color);
+      CGColorRetain (gc->cg_back_color);
+    }
+#endif
   XChangeGC (display, gc, mask, xgcv);
 
   return gc;
@@ -1582,6 +1662,10 @@
 {
   if (gc->clip_region)
     DisposeRgn (gc->clip_region);
+#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+  CGColorRelease (gc->cg_fore_color);
+  CGColorRelease (gc->cg_back_color);
+#endif
   xfree (gc);
 }
 
@@ -1618,6 +1702,29 @@
       gc->fore_color.red = RED16_FROM_ULONG (color);
       gc->fore_color.green = GREEN16_FROM_ULONG (color);
       gc->fore_color.blue = BLUE16_FROM_ULONG (color);
+#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+      if (CGColorGetTypeID != NULL)
+#endif
+	{
+	  CGColorRelease (gc->cg_fore_color);
+	  if (color == 0)
+	    {
+	      gc->cg_fore_color = mac_cg_color_black;
+	      CGColorRetain (gc->cg_fore_color);
+	    }
+	  else
+	    {
+	      float rgba[4];
+
+	      rgba[0] = gc->fore_color.red / 65535.0f;
+	      rgba[1] = gc->fore_color.green / 65535.0f;
+	      rgba[2] = gc->fore_color.blue / 65535.0f;
+	      rgba[3] = 1.0f;
+	      gc->cg_fore_color = CGColorCreate (mac_cg_color_space_rgb, rgba);
+	    }
+	}
+#endif
     }
 }
 
@@ -1636,6 +1743,29 @@
       gc->back_color.red = RED16_FROM_ULONG (color);
       gc->back_color.green = GREEN16_FROM_ULONG (color);
       gc->back_color.blue = BLUE16_FROM_ULONG (color);
+#if USE_CG_DRAWING && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+      if (CGColorGetTypeID != NULL)
+#endif
+	{
+	  CGColorRelease (gc->cg_back_color);
+	  if (color == 0)
+	    {
+	      gc->cg_back_color = mac_cg_color_black;
+	      CGColorRetain (gc->cg_back_color);
+	    }
+	  else
+	    {
+	      float rgba[4];
+
+	      rgba[0] = gc->back_color.red / 65535.0f;
+	      rgba[1] = gc->back_color.green / 65535.0f;
+	      rgba[2] = gc->back_color.blue / 65535.0f;
+	      rgba[3] = 1.0f;
+	      gc->cg_back_color = CGColorCreate (mac_cg_color_space_rgb, rgba);
+	    }
+	}
+#endif
     }
 }
 
@@ -8738,14 +8868,18 @@
 extern OSErr init_coercion_handler P_ ((void));
 
 /* Drag and Drop */
-OSErr install_drag_handler P_ ((WindowRef));
-void remove_drag_handler P_ ((WindowRef));
+extern OSErr install_drag_handler P_ ((WindowRef));
+extern void remove_drag_handler P_ ((WindowRef));
+
+/* Showing help echo string during menu tracking  */
+extern OSStatus install_menu_target_item_handler P_ ((WindowPtr));
 
 #if USE_CARBON_EVENTS
 #ifdef MAC_OSX
 extern void init_service_handler ();
 static Lisp_Object Qservice, Qpaste, Qperform;
 #endif
+
 /* Window Event Handler */
 static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
 						EventRef, void *);
@@ -10168,6 +10302,8 @@
 #endif
   if (err == noErr)
     err = install_drag_handler (window);
+  if (err == noErr)
+    err = install_menu_target_item_handler (window);
 
   return err;
 }
@@ -10215,7 +10351,7 @@
 
 #if __MWERKS__
   /* set creator and type for files created by MSL */
-  _fcreator = 'EMAx';
+  _fcreator = MAC_EMACS_CREATOR_CODE;
   _ftype = 'TEXT';
 #endif
 
@@ -11692,6 +11828,8 @@
 #endif
 
 #if USE_CG_DRAWING
+  init_cg_color ();
+
   mac_init_fringe ();
 #endif
 
--- a/src/macterm.h	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/macterm.h	Sat Jan 06 15:25:16 2007 +0000
@@ -528,6 +528,11 @@
 #define HOURGLASS_HEIGHT 16
 
 /* Some constants that are used locally.  */
+/* Creator code for Emacs on Mac OS.  */
+enum {
+  MAC_EMACS_CREATOR_CODE	= 'EMAx'
+};
+
 /* Apple event descriptor types */
 enum {
   TYPE_FILE_NAME		= 'fNam'
--- a/src/minibuf.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/minibuf.c	Sat Jan 06 15:25:16 2007 +0000
@@ -989,7 +989,7 @@
 one puts point at the beginning of the string.  *Note* that this
 behavior differs from the way such arguments are used in `completing-read'
 and some related functions, which use zero-indexing for POSITION.  */)
-(prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method)
+   (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method)
      Lisp_Object prompt, initial_contents, keymap, read, hist, default_value;
      Lisp_Object inherit_input_method;
 {
--- a/src/window.c	Mon Jan 01 18:32:06 2007 +0000
+++ b/src/window.c	Sat Jan 06 15:25:16 2007 +0000
@@ -1184,7 +1184,8 @@
 
   if (! NILP (update)
       && ! (! NILP (w->window_end_valid)
-	    && XFASTINT (w->last_modified) >= BUF_MODIFF (b))
+	    && XFASTINT (w->last_modified) >= BUF_MODIFF (b)
+	    && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (b))
       && !noninteractive)
     {
       struct text_pos startp;