changeset 108040:c585a710efe7

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 04 Apr 2010 21:58:17 +0000
parents ede2e6005460 (current diff) c34901ea512b (diff)
children b7e386fab1a9
files
diffstat 35 files changed, 504 insertions(+), 278 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 02 11:36:10 2010 +0000
+++ b/ChangeLog	Sun Apr 04 21:58:17 2010 +0000
@@ -3631,8 +3631,8 @@
 
 1999-10-09  Stefan Monnier  <monnier@cs.yale.edu>
 
-	* make-dist (dontcompile): look for the DONTCOMPILE variable rather
-	  than the obsolete dontcompilefiles pseudo-rule in lisp/Makefile.
+	* make-dist (dontcompile): Look for the DONTCOMPILE variable rather
+	than the obsolete dontcompilefiles pseudo-rule in lisp/Makefile.
 
 1999-10-09  Richard M. Stallman  <rms@gnu.org>
 
@@ -3641,7 +3641,7 @@
 
 1999-10-08  Stefan Monnier  <monnier@cs.yale.edu>
 
-	* update-subdirs: also ignore CVS subdirs.
+	* update-subdirs: Also ignore CVS subdirs.
 
 1999-10-07  Gerd Moellmann  <gerd@gnu.org>
 
@@ -6201,8 +6201,8 @@
 	src/Makefile.in is built from src/Makefile.
 
 	* Makefile.in (src/Makefile, lib-src/Makefile, oldXMenu/Makefile):
-	  If these files are out of date, simply have config.status
-	  rebuild them; don't rebuild them explicitly.
+	If these files are out of date, simply have config.status
+	rebuild them; don't rebuild them explicitly.
 
 1993-09-25  Brian J. Fox  (bfox@ai.mit.edu)
 
@@ -6397,7 +6397,7 @@
 
 1993-07-12  Frederic Pierresteguy  (F.Pierresteguy@frcl.bull.fr)
 
-	* configure.in (m68k-bull-sysv3): new config.
+	* configure.in (m68k-bull-sysv3): New config.
 
 1993-07-10  Jim Blandy  (jimb@geech.gnu.ai.mit.edu)
 
@@ -6620,7 +6620,7 @@
 
 	* make-dist: Rebuild configure if configure.in is newer.
 
-	* Makefile.in (src:, lib-src:, FRC:): force the src and lib-src
+	* Makefile.in (src:, lib-src:, FRC:): Force the src and lib-src
 	targets to be executed even if make remembers that it has already
 	satisfied FRC.
 
@@ -7120,7 +7120,7 @@
 	* make-dist: Don't distribute etc/Old files.
 
 	* GETTING.GNU.SOFTWARE, PROBLEMS: Registered into RCS with their
-	  backups.
+	backups.
 
 1993-03-20  Jim Blandy  (jimb@geech.gnu.ai.mit.edu)
 
@@ -7150,7 +7150,7 @@
 1993-03-17  Eric S. Raymond  (eric@mole.gnu.ai.mit.edu)
 
 	* Makefile.in: Add commented-out variable settings for developer's
-	  configuration.
+	configuration.
 
 1993-03-14  Jim Blandy  (jimb@wookumz.gnu.ai.mit.edu)
 
@@ -7765,7 +7765,7 @@
 	the script.
 	* INSTALL: Doc fix.
 
-	* Makefile: brought the Makefile up to the GNU coding
+	* Makefile: Brought the Makefile up to the GNU coding
 	standards, as described in standards.text:
 	(TAGS): New name for the target which rebuilds the tags table.
 	(check): New target; doesn't do anything yet.
--- a/doc/lispref/ChangeLog	Fri Apr 02 11:36:10 2010 +0000
+++ b/doc/lispref/ChangeLog	Sun Apr 04 21:58:17 2010 +0000
@@ -1,3 +1,13 @@
+2010-04-01  Chong Yidong  <cyd@stupidchicken.com>
+
+	* nonascii.texi (Text Representations): Don't mark
+	enable-multibyte-characters as a user option.
+
+2010-03-31  Eli Zaretskii  <eliz@gnu.org>
+
+	* control.texi (Handling Errors): How to re-throw a signal caught
+	by condition-case.
+
 2010-03-26  Chong Yidong  <cyd@stupidchicken.com>
 
 	* loading.texi (Hooks for Loading): Document after-load-functions.
--- a/doc/lispref/control.texi	Fri Apr 02 11:36:10 2010 +0000
+++ b/doc/lispref/control.texi	Sun Apr 04 21:58:17 2010 +0000
@@ -1023,6 +1023,20 @@
 
 If @var{var} is @code{nil}, that means no variable is bound.  Then the
 error symbol and associated data are not available to the handler.
+
+@cindex rethrow a signal
+Sometimes it is necessary to re-throw a signal caught by
+@code{condition-case}, for some outer-level handler to catch.  Here's
+how to do that:
+
+@smallexample
+  (signal (car err) (cdr err))
+@end smallexample
+
+@noindent
+where @code{err} is the error description variable, the first argument
+to @code{condition-case} whose error condition you want to re-throw.
+@xref{Definition of signal}.
 @end defspec
 
 @defun error-message-string error-description
@@ -1109,6 +1123,7 @@
 @end smallexample
 @end defmac
 
+
 @node Error Symbols
 @subsubsection Error Symbols and Condition Names
 @cindex error symbol
--- a/doc/lispref/nonascii.texi	Fri Apr 02 11:36:10 2010 +0000
+++ b/doc/lispref/nonascii.texi	Sun Apr 04 21:58:17 2010 +0000
@@ -37,7 +37,7 @@
 
   Emacs buffers and strings support a large repertoire of characters
 from many different scripts, allowing users to type and display text
-in most any known written language.
+in almost any known written language.
 
 @cindex character codepoint
 @cindex codespace
@@ -95,7 +95,7 @@
 The representation for a string is determined and recorded in the string
 when the string is constructed.
 
-@defopt enable-multibyte-characters
+@defvar enable-multibyte-characters
 This variable specifies the current buffer's text representation.
 If it is non-@code{nil}, the buffer contains multibyte text; otherwise,
 it contains unibyte encoded text or binary non-text data.
@@ -105,7 +105,7 @@
 
 The @samp{--unibyte} command line option does its job by setting the
 default value to @code{nil} early in startup.
-@end defopt
+@end defvar
 
 @defun position-bytes position
 Buffer positions are measured in character units.  This function
--- a/etc/AUTHORS	Fri Apr 02 11:36:10 2010 +0000
+++ b/etc/AUTHORS	Sun Apr 04 21:58:17 2010 +0000
@@ -33,8 +33,8 @@
 
 Adrian Robert: co-wrote ns-win.el
 and changed nsterm.m nsfns.m nsfont.m nsterm.h Makefile.in nsmenu.m
-  configure.in README config.in emacs.c font.c keyboard.c nsgui.h image.c
-  lisp.h macos.texi menu.c nsimage.m xdisp.c Info-gnustep.plist darwin.h
+  configure.in README config.in emacs.c font.c keyboard.c nsgui.h xdisp.c
+  image.c lisp.h macos.texi menu.c nsimage.m Info-gnustep.plist darwin.h
   and 83 other files
 
 Ævar Arnfjörð Bjarmason: changed rcirc.el
@@ -164,12 +164,12 @@
 
 Andreas Luik: changed xfns.c xterm.c
 
-Andreas Politz: changed elp.el ido.el term.el
+Andreas Politz: changed editfns.c elp.el ido.el term.el
 
 Andreas Schwab: changed Makefile.in configure.in lisp.h xdisp.c files.el
   coding.c alloc.c process.c print.c editfns.c fileio.c fns.c dired.el
   xterm.c keyboard.c simple.el eval.c info.el buffer.c sysdep.c emacs.c
-  and 480 other files
+  and 483 other files
 
 Andreas Seltenreich: changed nnweb.el gnus.texi message.el gnus.el
   nnslashdot.el gnus-util.el mm-url.el mm-uu.el url-http.el xterm.c
@@ -230,7 +230,7 @@
   ldap.el message.el mm-decode.el mml-sec.el mml.el mule-conf.el
   nnimap.el nnrss.el wid-edit.el
 
-Arni Magnusson: changed ada-mode.texi
+Arni Magnusson: changed ada-mode.texi frames.texi
 
 Artem Chuprina: changed message.el
 
@@ -282,7 +282,7 @@
 and changed vc.el gnus-msg.el message.el diff-mode.el ffap.el nnimap.el
   nnmbox.el simple.el vc-cvs.el
 
-Bernhard Herzog: changed vc-hg.el
+Bernhard Herzog: changed vc-hg.el menu.c
 
 Bernt Hansen: changed org-clock.el
 
@@ -433,10 +433,10 @@
 
 Chong Yidong: wrote redisplay-testsuite.el
 and co-wrote longlines.el
-and changed xdisp.c simple.el files.el display.texi files.texi
-  frames.texi keyboard.c cus-edit.el faces.el xterm.c Makefile.in
-  emacs.texi xfaces.c font.c startup.el xfns.c image.c misc.texi
-  compile.el configure.in custom.texi and 608 other files
+and changed xdisp.c simple.el files.el display.texi frames.texi
+  files.texi emacs.texi keyboard.c cus-edit.el faces.el xterm.c
+  Makefile.in xfaces.c font.c startup.el xfns.c misc.texi image.c
+  compile.el custom.texi text.texi and 633 other files
 
 Chris Chase: co-wrote idlw-shell.el idlwave.el
 
@@ -557,6 +557,8 @@
   emacs.c files.el term.c process.c vc-rcs.el bindings.el diff-mode.el
   lisp-mode.el and 840 other files
 
+Dan Rosenberg: changed movemail.c
+
 Daniel Brockman: changed cus-start.el format-spec.el ibuffer.el rcirc.el
 
 Daniel Colascione: co-wrote js.el
@@ -905,25 +907,26 @@
 
 Eric M. Ludlam: wrote analyze.el args.el autoconf-edit.el bovine.el c.el
   cedet-cscope.el cedet-files.el cedet-global.el cedet-idutils.el
-  cedet-utests.el chart.el checkdoc.el compile.el cpp-root.el
+  cedet-utests.el chart.el checkdoc.el compile.el complete.el cpp-root.el
   cscope.el ctxt.el data-debug.el db-debug.el db-el.el db-file.el
   db-find.el db-global.el db-mode.el db-ref.el db-typecache.el db.el
   debug.el decorate.el dep.el dframe.el dictionary.el dired.el doc.el
-  document.el ede-grammar.el ede.el edit.el eieio-base.el eieio-comp.el
-  eieio-custom.el eieio-datadebug.el eieio-opt.el eieio-speedbar.el
-  eieio.el el.el expandproto.el extract.el ezimage.el fcn.el
-  fields.el filter.el filters.el find.el format.el fw.el gcc.el
-  getset.el global.el grep.el html.el ia-sb.el ia.el idle.el idutils.el
-  include.el insert.el inversion.el java.el javascript.el lex-spp.el
-  lex.el linux.el list.el locate.el make.el makefile-edit.el map.el
-  mode.el mru-bookmark.el pconf.el pmake.el proj-archive.el proj-aux.el
-  proj-comp.el proj-elisp.el proj-info.el proj-misc.el proj-obj.el
-  proj-prog.el proj-scheme.el proj-shared.el proj.el project-am.el
-  pulse.el refs.el sb-image.el sb.el scm.el scope.el semantic-ia-utest.el
-  semantic-tests.el semantic-utest-c.el semantic-utest.el semantic.el
-  shell.el simple.el sort.el source.el speedbar.el srecode.el srt.el
+  document.el ede-grammar.el ede-tests.el ede.el edit.el eieio-base.el
+  eieio-comp.el eieio-custom.el eieio-datadebug.el eieio-opt.el
+  eieio-speedbar.el eieio.el el.el emacs.el expandproto.el extract.el
+  ezimage.el fcn.el fields.el files.el filter.el filters.el find.el
+  format.el fw.el gcc.el getset.el global.el grep.el html.el ia-sb.el
+  ia.el idle.el idutils.el imenu.el include.el insert.el inversion.el
+  java.el javascript.el lex-spp.el lex.el linux.el list.el locate.el
+  make.el makefile-edit.el map.el mode.el mru-bookmark.el pconf.el
+  pmake.el proj-archive.el proj-aux.el proj-comp.el proj-elisp.el
+  proj-info.el proj-misc.el proj-obj.el proj-prog.el proj-scheme.el
+  proj-shared.el proj.el project-am.el pulse.el refs.el sb-image.el sb.el
+  scm.el scope.el semantic-ia-utest.el semantic-tests.el
+  semantic-utest-c.el semantic-utest.el semantic.el shell.el simple.el
+  sort.el source.el speedbar.el srecode-tests.el srecode.el srt.el
   symref.el system.el table.el tag-file.el tag-ls.el tag-write.el tag.el
-  texi.el util.el
+  test.el texi.el util.el
 and co-wrote cpp.el db-ebrowse.el util-modes.el
 and changed *.el info.el rmail.el speedbspec.el gud.el sb-dir-minus.xpm
   sb-dir-plus.xpm sb-dir.xpm sb-mail.xpm sb-pg-minus.xpm sb-pg-plus.xpm
@@ -999,9 +1002,9 @@
 Florian Weimer: changed message.el gnus.el coding.c gnus-sum.el gnus.texi
   mm-decode.el mm-util.el
 
-Francesc Rocher: changed startup.el cus-start.el gnus.el gnus.png
-  gnus.svg macterm.c splash.png splash.svg splash8.xpm w32term.c xdisp.c
-  xterm.c
+Francesc Rocher: changed startup.el MORE.STUFF cus-start.el gnus.el
+  gnus.png gnus.svg macterm.c splash.png splash.svg splash8.xpm w32term.c
+  xdisp.c xterm.c
 
 Francesco Potortì: wrote cmacexp.el
 and changed etags.c man.el delta.h etags.1 undigest.el Makefile.in
@@ -1130,7 +1133,7 @@
   cal-menu.el cal-hebrew.el fortran.el holidays.el configure.in
   cal-islam.el bytecomp.el calendar.texi cal-bahai.el files.el appt.el
   cal-china.el emacs.texi rmailsum.el simple.el startup.el
-  and 972 other files
+  and 975 other files
 
 Glynn Clements: wrote gamegrid.el snake.el tetris.el
 
@@ -1342,7 +1345,7 @@
 Jan Djärv: wrote dnd.el font-setting.el x-dnd.el
 and changed gtkutil.c xterm.c xfns.c configure.in xterm.h xmenu.c
   x-win.el Makefile.in gtkutil.h keyboard.c frame.c frames.texi config.in
-  emacs.c xselect.c startup.el xresources.texi alloc.c cus-start.el
+  emacs.c xselect.c xresources.texi startup.el alloc.c cus-start.el
   xlwmenu.c process.c and 203 other files
 
 Jan Moringen: co-wrote cpp.el
@@ -1629,10 +1632,10 @@
 Juan León Lahoz García: wrote wdired.el
 and changed files.el perl-mode.el
 
-Juanma Barranquero: changed makefile.w32-in subr.el files.el bs.el
-  faces.el help-fns.el w32fns.c org.el server.el simple.el emacsclient.c
+Juanma Barranquero: changed makefile.w32-in subr.el files.el faces.el
+  bs.el help-fns.el w32fns.c org.el server.el simple.el emacsclient.c
   desktop.el buffer.c mule-cmds.el ido.el window.c xdisp.c allout.el
-  keyboard.c replace.el eval.c and 924 other files
+  keyboard.c replace.el eval.c and 930 other files
 
 Juergen Hoetzel: changed url-handlers.el
 
@@ -1729,7 +1732,7 @@
 and changed gnus-art.el message.el gnus-sum.el gnus.texi mm-decode.el
   mm-util.el mm-view.el rfc2047.el mml.el gnus-group.el gnus-msg.el
   gnus-util.el gnus-start.el gnus.el nntp.el gnus-agent.el nnrss.el
-  mm-uu.el nnmail.el emacs-mime.texi nnheader.el and 107 other files
+  mm-uu.el nnmail.el emacs-mime.texi nnheader.el and 108 other files
 
 Kaveh R. Ghazi: changed delta88k.h xterm.c
 
@@ -2948,6 +2951,8 @@
 
 Steinar Bang: changed imap.el
 
+Štěpán Němec: changed subr.el vc-git.el
+
 Stephan Stahl: changed which-func.el buff-menu.el buffer.c dired-x.texi
   ediff-mult.el
 
@@ -3083,7 +3088,7 @@
 
 Terry Jones: wrote shadow.el
 
-Tetsurou Okazaki: changed byte-opt.el log-edit.el xterm.c
+Tetsurou Okazaki: changed Makefile.in byte-opt.el log-edit.el xterm.c
 
 Thamer Mahmoud: changed arabic.el
 
@@ -3311,7 +3316,7 @@
 
 Wilson H. Tien: changed unexelf.c
 
-Wilson Snyder: changed verilog-mode.el
+Wilson Snyder: changed verilog-mode.el files.el
 
 Wim Nieuwenhuizen: changed TUTORIAL.nl
 
@@ -3343,7 +3348,7 @@
 Yamamoto Mitsuharu: changed macterm.c macfns.c mac-win.el mac.c macterm.h
   macmenu.c macgui.h image.c macselect.c xdisp.c keyboard.c xterm.c
   Makefile.in emacs.c darwin.h macos.texi unexmacosx.c w32term.c alloc.c
-  configure.in dispnew.c and 82 other files
+  configure.in dispnew.c and 83 other files
 
 Yann Dirson: changed imenu.el
 
--- a/etc/NEWS.23	Fri Apr 02 11:36:10 2010 +0000
+++ b/etc/NEWS.23	Sun Apr 04 21:58:17 2010 +0000
@@ -268,6 +268,7 @@
 
 To disable this check, set compose-mail-user-agent-warnings to nil.
 
+---
 ** The default value of mail-interactive is t, since Emacs 23.1.
 (This was not announced at the time.)  It means that when sending mail,
 Emacs will wait for the process sending mail to return.  If you
@@ -464,7 +465,7 @@
 
 
 * Lisp changes in Emacs 23.2
-
+---
 ** All the default-FOO variables that hold the default value of the FOO
 variable, are now declared obsolete.
 
--- a/lib-src/ChangeLog	Fri Apr 02 11:36:10 2010 +0000
+++ b/lib-src/ChangeLog	Sun Apr 04 21:58:17 2010 +0000
@@ -1,3 +1,15 @@
+2010-04-03  Juanma Barranquero  <lekktu@gmail.com>
+
+	Add stubs for Windows, required after CVE-2010-0825 change.
+	* ntlib.c (getgid, getegid, setegid): New stubs.
+	* ntlib.h (getgid, getegid, setegid): Declare them.
+
+2010-04-02  Dan Rosenberg  <dan.j.rosenberg@gmail.com>  (tiny change)
+
+	* movemail.c (main): Check return values of setuid.  Avoid
+	possibility of symlink attack when movemail is setgid mail
+	(CVE-2010-0825).
+
 2010-04-02  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	Remove extern errno declarations.
@@ -3967,7 +3979,7 @@
 	(xmalloc, fatal, error): New functions.
 	(delete_socket, handle_signals): New functions.
 	(progname, socket_name): New variables.
-	 [HAVE_SOCKETS] (main): Call handle_signals; set the new variables.
+	[HAVE_SOCKETS] (main): Call handle_signals; set the new variables.
 
 1996-09-01  Richard Stallman  <rms@ethanol.gnu.ai.mit.edu>
 
@@ -4740,9 +4752,9 @@
 1995-01-12  Francesco Potortì  (pot@cnuce.cnr.it)
 
 	* etags.c (FILEPOS, GET_CHARNO, GET_FILEPOS, max, LINENO): Deleted.
-	(append_to_tagfile, typedefs, typedefs_and_cplusplus,
-	 constantypedefs, update, vgrind_style, no_warnings,
-	 cxref_style, cplusplus, noindentypedefs): Were int, now logical.
+	(append_to_tagfile, typedefs, typedefs_and_cplusplus)
+	(constantypedefs, update, vgrind_style, no_warnings)
+	(cxref_style, cplusplus, noindentypedefs): Were int, now logical.
 	(permit_duplicates): Was a var, now a #define.
 	(filename_lb): Was global, now local to main.
 	(main): Open the tag file when in cxref mode.
@@ -4761,8 +4773,8 @@
 	(TOKEN_SAVED_P, SAVE_TOKEN, RESTORE_TOKEN): Deleted.
 	(C_entries): nameb and savenameb deleted.  Use dinamic allocation.
 	(pfcnt): Deleted.  Users updated.
-	(getit, Asm_labels, Pascal_functions, L_getit, get_scheme,
-	 TEX_getit, prolog_getit): Use dinamic allocation for storing
+	(getit, Asm_labels, Pascal_functions, L_getit, get_scheme)
+	(TEX_getit, prolog_getit): Use dinamic allocation for storing
 	the tag instead of a fixed size buffer.
 
 1995-01-10  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
@@ -6687,8 +6699,8 @@
 1990-01-19  David Lawrence  (tale@cocoa-puffs)
 
 	* timer.c, getdate.y (new files) and Makefile:
-	  Sub-process support for run-at-time in timer.el.
-	  Doesn't yet work correctly for USG.
+	Sub-process support for run-at-time in timer.el.
+	Doesn't yet work correctly for USG.
 
 1990-01-10  Jim Kingdon  (kingdon@pogo)
 
--- a/lib-src/movemail.c	Fri Apr 02 11:36:10 2010 +0000
+++ b/lib-src/movemail.c	Sun Apr 04 21:58:17 2010 +0000
@@ -194,6 +194,9 @@
 # define ARGSTR "p"
 #endif /* MAIL_USE_POP */
 
+  uid_t real_gid = getgid();
+  uid_t priv_gid = getegid();
+
 #ifdef WINDOWSNT
   /* Ensure all file i/o is in binary mode. */
   _fmode = _O_BINARY;
@@ -244,25 +247,6 @@
   if (*outname == 0)
     fatal ("Destination file name is empty", 0, 0);
 
-  /* Check access to output file.  */
-  if (access (outname, F_OK) == 0 && access (outname, W_OK) != 0)
-    pfatal_with_name (outname);
-
-  /* Also check that outname's directory is writable to the real uid.  */
-  {
-    char *buf = (char *) xmalloc (strlen (outname) + 1);
-    char *p;
-    strcpy (buf, outname);
-    p = buf + strlen (buf);
-    while (p > buf && !IS_DIRECTORY_SEP (p[-1]))
-      *--p = 0;
-    if (p == buf)
-      *p++ = '.';
-    if (access (buf, W_OK) != 0)
-      pfatal_with_name (buf);
-    free (buf);
-  }
-
 #ifdef MAIL_USE_POP
   if (!strncmp (inname, "po:", 3))
     {
@@ -274,15 +258,12 @@
       exit (status);
     }
 
-  setuid (getuid ());
+  if (setuid (getuid ()) < 0)
+    fatal ("Failed to drop privileges", 0, 0);
+
 #endif /* MAIL_USE_POP */
 
 #ifndef DISABLE_DIRECT_ACCESS
-
-  /* Check access to input file.  */
-  if (access (inname, R_OK | W_OK) != 0)
-    pfatal_with_name (inname);
-
 #ifndef MAIL_USE_MMDF
 #ifndef MAIL_USE_SYSTEM_LOCK
 #ifdef MAIL_USE_MAILLOCK
@@ -376,7 +357,8 @@
       time_t touched_lock, now;
 #endif
 
-      setuid (getuid ());
+      if (setuid (getuid ()) < 0 || setegid (real_gid) < 0)
+	fatal ("Failed to drop privileges", 0, 0);
 
 #ifndef MAIL_USE_MMDF
 #ifdef MAIL_USE_SYSTEM_LOCK
@@ -402,6 +384,9 @@
       if (outdesc < 0)
 	pfatal_with_name (outname);
 
+      if (setegid (priv_gid) < 0)
+	fatal ("Failed to regain privileges", 0, 0);
+
       /* This label exists so we can retry locking
 	 after a delay, if it got EAGAIN or EBUSY.  */
     retry_lock:
@@ -495,6 +480,10 @@
 	pfatal_and_delete (outname);
 #endif
 
+      /* Prevent symlink attacks truncating other users' mailboxes */
+      if (setegid (real_gid) < 0)
+	fatal ("Failed to drop privileges", 0, 0);
+
       /* Check to make sure no errors before we zap the inbox.  */
       if (close (outdesc) != 0)
 	pfatal_and_delete (outname);
@@ -526,6 +515,10 @@
 	}
 #endif /* not MAIL_USE_SYSTEM_LOCK */
 
+      /* End of mailbox truncation */
+      if (setegid (priv_gid) < 0)
+	fatal ("Failed to regain privileges", 0, 0);
+
 #ifdef MAIL_USE_MAILLOCK
       /* This has to occur in the child, i.e., in the process that
          acquired the lock! */
--- a/lib-src/ntlib.c	Fri Apr 02 11:36:10 2010 +0000
+++ b/lib-src/ntlib.c	Sun Apr 04 21:58:17 2010 +0000
@@ -125,12 +125,30 @@
   return 0;
 }
 
+unsigned
+getgid ()
+{
+  return 0;
+}
+
+unsigned
+getegid ()
+{
+  return 0;
+}
+
 int
 setuid (unsigned uid)
 {
   return 0;
 }
 
+int
+setegid (unsigned gid)
+{
+  return 0;
+}
+
 struct passwd *
 getpwuid (unsigned uid)
 {
--- a/lib-src/ntlib.h	Fri Apr 02 11:36:10 2010 +0000
+++ b/lib-src/ntlib.h	Sun Apr 04 21:58:17 2010 +0000
@@ -36,7 +36,10 @@
 char * getlogin ();
 char * cuserid (char * s);
 unsigned getuid ();
+unsigned getegid ();
+unsigned getgid ();
 int setuid (unsigned uid);
+int setegid (unsigned gid);
 char * getpass (const char * prompt);
 int fchown (int fd, unsigned uid, unsigned gid);
 
--- a/lisp/ChangeLog	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/ChangeLog	Sun Apr 04 21:58:17 2010 +0000
@@ -1,3 +1,69 @@
+2010-04-04  John Wiegley  <jwiegley@gmail.com>
+
+	* ido.el (ido-use-virtual-buffers): New variable to indicate
+	whether "virtual buffer" support is enabled for IDO.  Essentially
+	it works as follows: Say you are visiting a file and the buffer
+	gets cleaned up by mignight.el.  Later, you want to switch to that
+	buffer, but find it's no longer open.  With virtual buffers
+	enabled, the buffer name stays in the buffer list (using the
+	ido-virtual face, and always at the end), and if you select it, it
+	opens the file back up again.  This allows you to think less about
+	whether recently opened files are still open or not.  Most of the
+	time you can quit Emacs, restart, and then switch to a file buffer
+	that was previously open as if it still were.  NOTE: This feature
+	has been present in iswitchb for several years now, and I'm
+	porting the same logic to IDO.
+	(ido-virtual): Face used to indicate virtual buffers in the list.
+	(ido-buffer-internal): If a buffer is chosen, and no such buffer
+	exists, but a virtual buffer of that name does (which would be why
+	it was in the list), recreate the buffer by reopening the file.
+	(ido-make-buffer-list): If virtual buffers are being used, call
+	`ido-add-virtual-buffers-to-list' before the make list hook.
+	(ido-virtual-buffers): New variable which contains a copy of the
+	current contents of the `recentf-list', albeit pared down for the
+	sake of speed, and with proper faces applied.
+	(ido-add-virtual-buffers-to-list): Using the `recentf-list',
+	create a list of "virtual buffers" to present to the user in
+	addition to the currently open set.  Note that this logic could
+	get rather slow if that list is too large.  With the default
+	`recentf-max-saved-items' of 200, there is little speed penalty.
+
+2010-04-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* font-lock.el: Require CL when compiling.
+	(font-lock-turn-on-thing-lock): Use `case'.
+
+2010-04-03  Eli Zaretskii  <eliz@gnu.org>
+
+	* emacs-lisp/authors.el (authors-fixed-entries): Add entry for Eli
+	Zaretskii.
+
+2010-04-02  Juanma Barranquero  <lekktu@gmail.com>
+
+	* cedet/semantic/imenu.el (semantic-imenu-bucketize-type-members)
+	(semantic-create-imenu-directory-index): Fix typos in docstrings.
+	(semantic-imenu-goto-function): Reflow docstring.
+
+2010-04-02  Juri Linkov  <juri@jurta.org>
+
+	* ehelp.el (electric-help-orig-major-mode):
+	New buffer-local variable.
+	(electric-help-mode): Set it to original major-mode.  Doc fix.
+	(with-electric-help): Use `electric-help-orig-major-mode' instead
+	of (default-value 'major-mode).  Doc fix.
+	http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00069.html
+
+2010-04-02  Sam Steingold  <sds@gnu.org>
+
+	* vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling
+	`vc-hg-command' with a list of flags.
+
+	* progmodes/bug-reference.el (bug-reference-bug-regexp):
+	Also accept "patch" and "RFE".
+	(bug-reference-fontify): `bug-reference-url-format' can also be a
+	function to be able to handle the bug kind.
+	(turn-on-bug-reference-mode, turn-on-bug-reference-prog-mode): Add.
+
 2010-04-02  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* tmm.el (tmm-get-keymap): Check with symbolp before passing
@@ -5,8 +71,7 @@
 
 2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
-	* cus-edit.el (custom-buffer-sort-alphabetically): Update
-	:version.
+	* cus-edit.el (custom-buffer-sort-alphabetically): Update :version.
 
 2010-03-31  Juri Linkov  <juri@jurta.org>
 
@@ -3861,7 +3926,7 @@
 	* bookmark.el: Formatting and doc fixes only:
 	(bookmark-search-delay): Shorten doc string to fit in 80 columns.
 	(bookmark-bmenu-search): Wrap to fit within 80 columns.
-	  Minor grammar and punctuation fixes in doc string.
+	Minor grammar and punctuation fixes in doc string.
 	(bookmark-read-search-input): Adjust to fit within 80 columns.
 
 2009-11-20  Tassilo Horn  <tassilo@member.fsf.org>
@@ -6616,12 +6681,12 @@
 2009-10-05  Karl Fogel  <kfogel@red-bean.com>
 
 	* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
-	  don't do anything related to relocating, just return nil.
+	don't do anything related to relocating, just return nil.
 	(bookmark-error-no-filename): New error.
 	(bookmark-default-handler): Signal `bookmark-error-no-filename' if
-	  bookmark has no file.  Don't even attempt to handle things that
-	  are not files; the whole point of custom handlers is to keep that
-	  knowledge elsewhere anyway.  Tighten some comments.
+	bookmark has no file.  Don't even attempt to handle things that
+	are not files; the whole point of custom handlers is to keep that
+	knowledge elsewhere anyway.  Tighten some comments.
 	(bookmark-file-or-variation-thereof): Remove now-unused function.
 	(bookmark-location): Doc string fix.
 	(Bug#4250)
@@ -6651,8 +6716,8 @@
 	(bookmark-relocate, bookmark-insert-location, bookmark-rename)
 	(bookmark-insert, bookmark-delete, bookmark-time-to-save-p)
 	(bookmark-edit-annotation-mode, bookmark-edit-annotation):
-	   Improve doc strings to say whether bookmark can be a string or
-	   a record or both, and make other consistency and clarity fixes.
+	Improve doc strings to say whether bookmark can be a string or
+	a record or both, and make other consistency and clarity fixes.
 	(bookmark-get-handler, bookmark--jump-via, bookmark-write-file)
 	(bookmark-default-annotation-text, bookmark-yank-word)
 	(bookmark-maybe-load-default-file, bookmark-maybe-sort-alist)
@@ -6660,12 +6725,12 @@
 	(bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames)
 	(bookmark-bmenu-bookmark): Give these doc strings.
 	(bookmark-bmenu-check-position): Give this a doc string, but also
-	   add a FIXME comment about how the function may be pointless.
+	add a FIXME comment about how the function may be pointless.
 	(bookmark-default-handler): Rework doc string and change a
-	   parameter name, to clarify that this takes a bookmark record
-	   not a bookmark name.
+	parameter name, to clarify that this takes a bookmark record
+	not a bookmark name.
 	(bookmark-set): Change a parameter name to indicate its meaning,
-	   and improve the doc string a bit.
+	and improve the doc string a bit.
 	(Bug#4188)
 
 2009-10-04  Karl Fogel  <kfogel@red-bean.com>
--- a/lisp/cedet/semantic/db-find.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/cedet/semantic/db-find.el	Sun Apr 04 21:58:17 2010 +0000
@@ -774,7 +774,7 @@
 		 (buffer-name))
 
       (data-debug-new-buffer "*SEMANTICDB lost-includes ADEBUG*")
-      (data-debug-insert-tag-list lost "*")
+      ;; (data-debug-insert-tag-list lost "*")
       )))
 
 (defun semanticdb-find-adebug-insert-scanned-tag-cons (consdata prefix prebuttontext)
--- a/lisp/cedet/semantic/imenu.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/cedet/semantic/imenu.el	Sun Apr 04 21:58:17 2010 +0000
@@ -95,7 +95,7 @@
 
 (defcustom semantic-imenu-bucketize-type-members t
   "*Non-nil if members of a type should be grouped into buckets.
-nil means to keep them in the same order.
+A nil value means to keep them in the same order.
 Overriden to nil if `semantic-imenu-bucketize-file' is nil."
   :group 'semantic-imenu
   :type 'boolean)
@@ -167,8 +167,8 @@
 
 (defun semantic-imenu-goto-function (name position &optional rest)
   "Move point associated with NAME to POSITION.
-Used to override function `imenu-default-goto-function' so that we can continue
-to use overlays to maintain the current position.
+Used to override function `imenu-default-goto-function' so that
+we can continue to use overlays to maintain the current position.
 Optional argument REST is some extra stuff."
   (require 'pulse)
   (if (semantic-overlay-p position)
@@ -249,7 +249,7 @@
               'semantic-imenu-flush-fcn nil t)))
 
 (defun semantic-create-imenu-directory-index (&optional stream)
-  "Create an IMENU tag index based on all files active in semanticdb.
+  "Create an imenu tag index based on all files active in semanticdb.
 Optional argument STREAM is the stream of tags for the current buffer."
   (if (not semanticdb-current-database)
       (semantic-create-imenu-index-1 stream nil)
--- a/lisp/ehelp.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/ehelp.el	Sun Apr 04 21:58:17 2010 +0000
@@ -94,10 +94,14 @@
     map)
   "Keymap defining commands available in `electric-help-mode'.")
 
+(defvar electric-help-orig-major-mode nil)
+(make-variable-buffer-local 'electric-help-orig-major-mode)
+
 (defun electric-help-mode ()
   "`with-electric-help' temporarily places its buffer in this mode.
-\(On exit from `with-electric-help', the buffer is put in default `major-mode'.)"
+\(On exit from `with-electric-help', the original `major-mode' is restored.)"
   (setq buffer-read-only t)
+  (setq electric-help-orig-major-mode major-mode)
   (setq mode-name "Help")
   (setq major-mode 'help)
   (setq mode-line-buffer-identification '(" Help:  %b"))
@@ -131,7 +135,7 @@
 
 When the user exits (with `electric-help-exit', or otherwise), the help
 buffer's window disappears (i.e., we use `save-window-excursion'), and
-BUFFER is put into default `major-mode' (or `fundamental-mode')."
+BUFFER is put back into its original major mode."
   (setq buffer (get-buffer-create (or buffer "*Help*")))
   (let ((one (one-window-p t))
 	(config (current-window-configuration))
@@ -170,13 +174,17 @@
       (set-buffer buffer)
       (setq buffer-read-only nil)
 
+      ;; Restore the original major mode saved by `electric-help-mode'.
       ;; We should really get a usable *Help* buffer when retaining
       ;; the electric one with `r'.  The problem is that a simple
-      ;; call to help-mode won't cut it; at least RET is bound wrong
-      ;; afterwards.  It's also not clear that `help-mode' is always
-      ;; the right thing, maybe we should add an optional parameter.
+      ;; call to `help-mode' won't cut it; e.g. RET is bound wrong
+      ;; afterwards (`View-scroll-line-forward' instead of `help-follow').
+      ;; That's because Help mode should be set with `with-help-window'
+      ;; instead of the direct call to `help-mode'. But at least
+      ;; RET works correctly on links after using `help-mode'.
+      ;; This is satisfactory enough.
       (condition-case ()
-          (funcall (or (default-value 'major-mode) 'fundamental-mode))
+          (funcall (or electric-help-orig-major-mode 'fundamental-mode))
         (error nil))
 
       (set-window-configuration config)
--- a/lisp/emacs-lisp/authors.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/emacs-lisp/authors.el	Sun Apr 04 21:58:17 2010 +0000
@@ -427,6 +427,7 @@
     ("Geoff Voelker" :wrote "w32-fns.el" "w32.c" "w32.h" "w32heap.c"
      "w32heap.h" "w32inevt.c" "w32proc.c" "w32term.c" "ms-w32.h")
     ("Morten Welinder" :wrote "dosfns.c" "[many MS-DOS files]" "msdos.h")
+    ("Eli Zaretskii" :wrote "bidi.c" "[bidirectional display in xdisp.c]")
     ;; Not using this version any more.
 ;;;    ("Pace Willisson" :wrote "ispell.el")
     ;; FIXME overwritten by Author:.
--- a/lisp/font-lock.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/font-lock.el	Sun Apr 04 21:58:17 2010 +0000
@@ -209,6 +209,7 @@
 ;;; Code:
 
 (require 'syntax)
+(eval-when-compile (require 'cl))
 
 ;; Define core `font-lock' group.
 (defgroup font-lock '((jit-lock custom-group))
@@ -902,26 +903,24 @@
 (declare-function lazy-lock-mode "lazy-lock")
 
 (defun font-lock-turn-on-thing-lock ()
-  (let ((thing-mode (font-lock-value-in-major-mode font-lock-support-mode)))
-    (cond ((eq thing-mode 'fast-lock-mode)
-	   (fast-lock-mode t))
-	  ((eq thing-mode 'lazy-lock-mode)
-	   (lazy-lock-mode t))
-	  ((eq thing-mode 'jit-lock-mode)
-	   ;; Prepare for jit-lock
-	   (remove-hook 'after-change-functions
-			'font-lock-after-change-function t)
-	   (set (make-local-variable 'font-lock-fontify-buffer-function)
-		'jit-lock-refontify)
-	   ;; Don't fontify eagerly (and don't abort if the buffer is large).
-	   (set (make-local-variable 'font-lock-fontified) t)
-	   ;; Use jit-lock.
-	   (jit-lock-register 'font-lock-fontify-region
-			      (not font-lock-keywords-only))
-           ;; Tell jit-lock how we extend the region to refontify.
-           (add-hook 'jit-lock-after-change-extend-region-functions
-                     'font-lock-extend-jit-lock-region-after-change
-                     nil t)))))
+  (case (font-lock-value-in-major-mode font-lock-support-mode)
+    (fast-lock-mode (fast-lock-mode t))
+    (lazy-lock-mode (lazy-lock-mode t))
+    (jit-lock-mode
+     ;; Prepare for jit-lock
+     (remove-hook 'after-change-functions
+                  'font-lock-after-change-function t)
+     (set (make-local-variable 'font-lock-fontify-buffer-function)
+          'jit-lock-refontify)
+     ;; Don't fontify eagerly (and don't abort if the buffer is large).
+     (set (make-local-variable 'font-lock-fontified) t)
+     ;; Use jit-lock.
+     (jit-lock-register 'font-lock-fontify-region
+                        (not font-lock-keywords-only))
+     ;; Tell jit-lock how we extend the region to refontify.
+     (add-hook 'jit-lock-after-change-extend-region-functions
+               'font-lock-extend-jit-lock-region-after-change
+               nil t))))
 
 (defun font-lock-turn-off-thing-lock ()
   (cond ((bound-and-true-p fast-lock-mode)
--- a/lisp/gnus/ChangeLog	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/gnus/ChangeLog	Sun Apr 04 21:58:17 2010 +0000
@@ -1,3 +1,8 @@
+2010-04-01  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* mm-uu.el (mm-uu-pgp-signed-extract-1): Use buffer-file-coding-system
+	if set.
+
 2010-03-31  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-art.el (gnus-article-browse-html-save-cid-content): Rename from
--- a/lisp/gnus/mm-uu.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/gnus/mm-uu.el	Sun Apr 04 21:58:17 2010 +0000
@@ -486,9 +486,11 @@
       (if (mm-uu-pgp-signed-test)
 	  (progn
 	    (mml2015-clean-buffer)
-	    (let ((coding-system-for-write (or gnus-newsgroup-charset
+	    (let ((coding-system-for-write (or buffer-file-coding-system
+					       gnus-newsgroup-charset
 					       'iso-8859-1))
-		  (coding-system-for-read (or gnus-newsgroup-charset
+		  (coding-system-for-read (or buffer-file-coding-system
+					      gnus-newsgroup-charset
 					      'iso-8859-1)))
 	      (funcall (mml2015-clear-verify-function))))
 	(when (and mml2015-use (null (mml2015-clear-verify-function)))
--- a/lisp/ido.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/ido.el	Sun Apr 04 21:58:17 2010 +0000
@@ -774,6 +774,13 @@
   :type '(repeat string)
   :group 'ido)
 
+(defcustom ido-use-virtual-buffers nil
+  "If non-nil, refer to past buffers as well as existing ones.
+This feature relies upon the `recentf' package, which will be
+enabled if this variable is configured to a non-nil value."
+  :type 'boolean
+  :group 'ido)
+
 (defcustom ido-use-faces t
   "Non-nil means use ido faces to highlighting first match, only match and
 subdirs in the alternatives."
@@ -798,6 +805,10 @@
   "Face used by ido for highlighting subdirs in the alternatives."
   :group 'ido)
 
+(defface ido-virtual '((t (:inherit font-lock-builtin-face)))
+  "Face used by ido for matching virtual buffer names."
+  :group 'ido)
+
 (defface ido-indicator  '((((min-colors 88) (class color))
 				(:foreground "yellow1"
 				 :background "red1"
@@ -2155,7 +2166,8 @@
 	   (ido-directory-too-big nil)
 	   (require-match (confirm-nonexistent-file-or-buffer))
 	   (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default
-				   require-match initial)))
+				   require-match initial))
+	   filename)
 
       ;; Choose the buffer name: either the text typed in, or the head
       ;; of the list of matches
@@ -2191,6 +2203,16 @@
 		 (point))))
 	  (ido-visit-buffer buf method t)))
 
+       ;; check for a virtual buffer reference
+       ((and ido-use-virtual-buffers ido-virtual-buffers
+	     (setq filename (assoc buf ido-virtual-buffers)))
+	(ido-visit-buffer (find-file-noselect (cdr filename)) method t))
+
+       ((and (eq ido-create-new-buffer 'prompt)
+	     (null require-match)
+	     (not (y-or-n-p (format "No buffer matching `%s', create one? " buf))))
+	nil)
+
        ;; buffer doesn't exist
        ((and (eq ido-create-new-buffer 'never)
 	     (null require-match))
@@ -3350,9 +3372,41 @@
 		(delete default ido-temp-list))
 	  (setq ido-temp-list
 		(cons default ido-temp-list))))
+    (if ido-use-virtual-buffers
+	(ido-add-virtual-buffers-to-list))
     (run-hooks 'ido-make-buffer-list-hook)
     ido-temp-list))
 
+(defvar ido-virtual-buffers nil)
+
+(defun ido-add-virtual-buffers-to-list ()
+  "Add recently visited files, and bookmark files, to the buffer list.
+This is to make them appear as if they were \"virtual buffers\"."
+  ;; If no buffers matched, and virtual buffers are being used, then
+  ;; consult the list of past visited files, to see if we can find
+  ;; the file which the user might thought was still open.
+  (setq ido-virtual-buffers nil)
+  (let ((head recentf-list) name)
+    (while head
+      (if (and (setq name (file-name-nondirectory (car head)))
+	       (null (get-file-buffer (car head)))
+	       (not (assoc name ido-virtual-buffers))
+	       (not (ido-ignore-item-p name ido-ignore-buffers))
+	       ;;(file-exists-p (car head))
+	       )
+	  (setq ido-virtual-buffers
+		(cons (cons name (car head)) ido-virtual-buffers)))
+      (setq head (cdr head))))
+  (when ido-virtual-buffers
+    (if ido-use-faces
+	(dolist (comp ido-virtual-buffers)
+	  (put-text-property 0 (length (car comp))
+			     'face 'ido-virtual
+			     (car comp))))
+    (setq ido-temp-list
+	  (nconc ido-temp-list
+		 (nreverse (mapcar #'car ido-virtual-buffers))))))
+
 (defun ido-make-choice-list (default)
   ;; Return the current list of choices.
   ;; If DEFAULT is non-nil, and corresponds to an element of choices,
--- a/lisp/ldefs-boot.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/ldefs-boot.el	Sun Apr 04 21:58:17 2010 +0000
@@ -1319,7 +1319,7 @@
 
 Variables
 
- This is a brief overview of the different varaibles. For more info,
+ This is a brief overview of the different variables.  For more info,
  see the documentation for the variables (type \\[describe-variable] <variable> RET).
 
  artist-rubber-banding		Interactively do rubber-banding or not
@@ -23982,9 +23982,11 @@
 (custom-autoload 'mail-signature-file "sendmail" t)
 
 (defvar mail-default-directory (purecopy "~/") "\
-Directory for mail buffers.
-Value of `default-directory' for mail buffers.
-This directory is used for auto-save files of mail buffers.")
+Value of `default-directory' for Mail mode buffers.
+This directory is used for auto-save files of Mail mode buffers.
+
+Note that Message mode does not use this variable; it auto-saves
+in `message-auto-save-directory'.")
 
 (custom-autoload 'mail-default-directory "sendmail" t)
 
@@ -29315,9 +29317,10 @@
 \(fn HISTORIC &optional NOT-URGENT)" t nil)
 
 (autoload 'vc-root-diff "vc" "\
-Display diffs between file revisions.
-Normally this compares the currently selected fileset with their
-working revisions.  With a prefix argument HISTORIC, it reads two revision
+Display diffs between VC-controlled whole tree revisions.
+Normally, this compares the tree corresponding to the current
+fileset with the working revision.
+With a prefix argument HISTORIC, prompt for two revision
 designators specifying which revisions to compare.
 
 The optional argument NOT-URGENT non-nil means it is ok to say no to
@@ -29372,12 +29375,20 @@
 
 (autoload 'vc-print-log "vc" "\
 List the change log of the current fileset in a window.
-If WORKING-REVISION is non-nil, leave the point at that revision.
+If WORKING-REVISION is non-nil, leave point at that revision.
+If LIMIT is non-nil, it should be a number specifying the maximum
+number of revisions to show; the default is `vc-log-show-limit'.
+
+When called interactively with a prefix argument, prompt for
+WORKING-REVISION and LIMIT.
 
 \(fn &optional WORKING-REVISION LIMIT)" t nil)
 
 (autoload 'vc-print-root-log "vc" "\
-List the change log of for the current VC controlled tree in a window.
+List the change log for the current VC controlled tree in a window.
+If LIMIT is non-nil, it should be a number specifying the maximum
+number of revisions to show; the default is `vc-log-show-limit'.
+When called interactively with a prefix argument, prompt for LIMIT.
 
 \(fn &optional LIMIT)" t nil)
 
--- a/lisp/progmodes/bug-reference.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/progmodes/bug-reference.el	Sun Apr 04 21:58:17 2010 +0000
@@ -41,13 +41,20 @@
 (defvar bug-reference-url-format nil
   "Format used to turn a bug number into a URL.
 The bug number is supplied as a string, so this should have a single %s.
+This can also be a function designator; it is called without arguments
+ and should return a string.
+It can use `match-string' to get parts matched against
+`bug-reference-bug-regexp', specifically:
+ 1. issue kind (bug, patch, rfe &c)
+ 2. issue number.
+
 There is no default setting for this, it must be set per file.")
 
 ;;;###autoload
 (put 'bug-reference-url-format 'safe-local-variable 'stringp)
 
 (defconst bug-reference-bug-regexp
-  "\\(?:[Bb]ug ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
+  "\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
   "Regular expression which matches bug references.")
 
 (defun bug-reference-set-overlay-properties ()
@@ -87,9 +94,11 @@
 	    (overlay-put overlay 'category 'bug-reference)
 	    ;; Don't put a link if format is undefined
 	    (when bug-reference-url-format
-	      (overlay-put overlay 'bug-reference-url
-			   (format bug-reference-url-format
-				   (match-string-no-properties 1))))))))))
+              (overlay-put overlay 'bug-reference-url
+                           (if (stringp bug-reference-url-format)
+                               (format bug-reference-url-format
+                                       (match-string-no-properties 2))
+                             (funcall bug-reference-url-format))))))))))
 
 ;; Taken from button.el.
 (defun bug-reference-push-button (&optional pos use-mouse-action)
@@ -121,6 +130,11 @@
       (widen)
       (bug-reference-unfontify (point-min) (point-max)))))
 
+(defun turn-on-bug-reference-mode ()
+  "Unconditionally turn bug reference mode on."
+  (unless bug-reference-mode
+    (bug-reference-mode)))
+
 ;;;###autoload
 (define-minor-mode bug-reference-prog-mode
   "Like `bug-reference-mode', but only buttonize in comments and strings."
@@ -134,5 +148,10 @@
       (widen)
       (bug-reference-unfontify (point-min) (point-max)))))
 
+(defun turn-on-bug-reference-prog-mode ()
+  "Unconditionally turn bug reference prog mode on."
+  (unless bug-reference-prog-mode
+    (bug-reference-prog-mode)))
+
 ;; arch-tag: b138abce-e5c3-475e-bd58-7afba40387ea
 ;;; bug-reference.el ends here
--- a/lisp/tmm.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/tmm.el	Sun Apr 04 21:58:17 2010 +0000
@@ -465,8 +465,8 @@
 	      ((if (listp (cdr-safe (cdr-safe elt)))
 		   (or (keymapp (cdr-safe (cdr-safe elt)))
 		       (eq (car (cdr-safe (cdr-safe elt))) 'lambda))
-		 (and (symbolp (cdr-safe (cdr-safe elt))
-			       (fboundp (cdr-safe (cdr-safe elt))))))
+		 (and (symbolp (cdr-safe (cdr-safe elt)))
+			       (fboundp (cdr-safe (cdr-safe elt)))))
 	       (setq km (cddr elt))
 	       (and (stringp (car elt)) (setq str (car elt)))
 	       (and str
--- a/lisp/vc-hg.el	Fri Apr 02 11:36:10 2010 +0000
+++ b/lisp/vc-hg.el	Sun Apr 04 21:58:17 2010 +0000
@@ -235,10 +235,10 @@
     (with-current-buffer
 	buffer
       (apply 'vc-hg-command buffer 0 files "log"
-	     (append
+	     (nconc
 	      (when start-revision (list (format "-r%s:" start-revision)))
 	      (when limit (list "-l" (format "%s" limit)))
-	      (when shortlog '("--style" "compact"))
+	      (when shortlog (list "--style" "compact"))
 	      vc-hg-log-switches)))))
 
 (defvar log-view-message-re)
@@ -419,7 +419,8 @@
 (defun vc-hg-checkin (files rev comment &optional extra-args)
   "Hg-specific version of `vc-backend-checkin'.
 REV is ignored."
-  (apply 'vc-hg-command nil 0 files  (append (list "commit" "-m" comment) extra-args)))
+  (apply 'vc-hg-command nil 0 files
+         (nconc (list "commit" "-m" comment) extra-args)))
 
 (defun vc-hg-find-revision (file rev buffer)
   (let ((coding-system-for-read 'binary)
@@ -611,22 +612,22 @@
   (interactive)
   (let ((marked-list (log-view-get-marked)))
     (if marked-list
-        (vc-hg-command
-         nil 0 nil
-         (cons "push"
+        (apply #'vc-hg-command
+               nil 0 nil
+               "push"
                (apply 'nconc
-                      (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
-         (error "No log entries selected for push"))))
+                      (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
+      (error "No log entries selected for push"))))
 
 (defun vc-hg-pull ()
   (interactive)
   (let ((marked-list (log-view-get-marked)))
     (if marked-list
-        (vc-hg-command
-         nil 0 nil
-         (cons "pull"
+        (apply #'vc-hg-command
+               nil 0 nil
+               "pull"
                (apply 'nconc
-                      (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
+                      (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
       (error "No log entries selected for pull"))))
 
 ;;; Internal functions
--- a/msdos/ChangeLog	Fri Apr 02 11:36:10 2010 +0000
+++ b/msdos/ChangeLog	Sun Apr 04 21:58:17 2010 +0000
@@ -735,7 +735,7 @@
 
 1994-04-30  Morten Welinder  (terra@diku.dk)
 
-	* sed1.inp: don't comment out the inc-vers run as that
+	* sed1.inp: Don't comment out the inc-vers run as that
 	does not exist anymore.
 	Don't reset DEBUG_MOLE as that no longer is used.
 	Identify the file being patched as src/...
@@ -758,7 +758,7 @@
 
 1994-01-08  Morten Welinder  (terra@diku.dk)
 
-	* sed3.inp: improve make-compatibility by not using drive
+	* sed3.inp: Improve make-compatibility by not using drive
 	specifications and by not specifying an explicit shell.
 
 1994-01-07  Morten Welinder  (terra@diku.dk)
--- a/src/ChangeLog	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/ChangeLog	Sun Apr 04 21:58:17 2010 +0000
@@ -1,3 +1,31 @@
+2010-04-04  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xfns.c (set_machine_and_pid_properties): New function.
+	(Fx_create_frame): Call set_machine_and_pid_properties.
+
+2010-04-03  Eli Zaretskii  <eliz@gnu.org>
+
+	* bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check
+	bidi_it->bytepos against ZV_BYTE instead of bidi_it->ch against
+	BIDI_EOB.  Fixes infloop with vertical cursor motion at ZV.
+
+	* w32fns.c (x_create_tip_frame): Copy `parms' before we modify it
+	in this function.  (Bug#5703)
+
+2010-04-03  Chong Yidong  <cyd@stupidchicken.com>
+
+	* nsterm.h: Fix last change.
+
+2010-04-03  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* m/intel386.h (NO_REMAP): Move definition ...
+	* s/msdos.h (NO_REMAP): ... here.
+
+	* m/vax.h (CRT0_DUMMIES): Remove, unused.
+
+	* ecrt0.c: Remove MSDOS, m68k and __sparc__ conditionals, file not
+	used on those platforms.
+
 2010-04-02  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	Remove extern errno declarations.
@@ -118,7 +146,7 @@
 
 	* xdisp.c (x_consider_frame_title, update_window_cursor):
 	Remove HAVE_NS conditionals.
-	(prepare_menu_bars)[HAVE_NS]: Call ns_set_doc_edited.
+	(prepare_menu_bars) [HAVE_NS]: Call ns_set_doc_edited.
 
 	* nsfns.m (x_implicitly_set_name): If frame-title-format is t, use
 	filename for the title.
@@ -475,7 +503,7 @@
 2010-03-12  Eli Zaretskii  <eliz@gnu.org>
 
 	These changes remove termcap.c from the build on Posix platforms.
-	* Makefilie.in (termcapobj): Move termcap.o from here...
+	* Makefile.in (termcapobj): Move termcap.o from here...
 	(MSDOS_OBJ): ...to here.
 	(termcapobj) [!LIBS_TERMCAP]: Remove specialized value, as it is
 	now identical to when LIBS_TERMCAP is defined.
@@ -760,7 +788,7 @@
 2010-01-19  Alan Mackenzie  <acm@muc.de>
 
 	Fix spurious before-change-functions invocation from (insert ?\n).
-	* textprop.c (set_text_properties): rename parameter
+	* textprop.c (set_text_properties): Rename parameter
 	`signal_after_change_p' to `coherent_change_p', and make the
 	invocation of `modify_region' conditional on it.
 
@@ -10782,7 +10810,7 @@
 
 	* font.c (Vfont_encoding_alist, find_font_encoding): Move from
 	fontset.c.
-	(font_pixel_size)[! HAVE_WINDOW_SYSTEM]: Return 1.
+	(font_pixel_size) [! HAVE_WINDOW_SYSTEM]: Return 1.
 	(font_open_entity): Update FRAME_X_DISPLAY_INFO (f)->n_fonts,
 	FRAME_SMALLEST_CHAR_WIDTH (f), and FRAME_SMALLEST_FONT_HEIGHT (f)
 	only when HAVE_WINDOW_SYSTEM is defined.
@@ -20616,7 +20644,7 @@
 
 2007-08-29  ARISAWA Akihiro  <ari@mbf.ocn.ne.jp>  (tiny change)
 
-	* term.c (dissociate_if_controlling_tty)[USG]: Fix parse error.
+	* term.c (dissociate_if_controlling_tty) [USG]: Fix parse error.
 
 2007-08-29  Yoshiaki Kasahara  <kasahara@nc.kyushu-u.ac.jp>  (tiny change)
 
--- a/src/ChangeLog.10	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/ChangeLog.10	Sun Apr 04 21:58:17 2010 +0000
@@ -2137,7 +2137,7 @@
 
 	* Makefile.in (keymap.o): Add "keymap.h" and "window.h" dependencies.
 
-	* keymap.c: include "window.h".
+	* keymap.c: Include "window.h".
 	(Fcommand_remapping): New optional POSITION argument.
 	(Fkey_binding): New optional POSITION argument.  Completely rework
 	handling of mouse clicks to get the same order of keymaps as
@@ -5867,9 +5867,9 @@
 
 2005-12-26  Luc Teirlinck  <teirllm@auburn.edu>
 
-	* keyboard.h: extern last_point_position_window.
-
-	* undo.c: include keyboard.h.
+	* keyboard.h: Extern last_point_position_window.
+
+	* undo.c: Include keyboard.h.
 
 	* Makefile.in (undo.o): Depend on keyboard.h.
 
@@ -8276,7 +8276,7 @@
 	* xdisp.c (syms_of_xdisp) <nobreak-char-display>: Doc fix.
 	(syms_of_xdisp) <void-text-area-pointer>: Doc fix.
 
-	* fileio.c (Frename_file)[!DOS_NT]: Don't call chown on MSDOS/Windows.
+	* fileio.c (Frename_file) [!DOS_NT]: Don't call chown on MSDOS/Windows.
 
 2005-06-23  Richard M. Stallman  <rms@gnu.org>
 
@@ -12611,7 +12611,7 @@
 	* macterm.c (mac_check_for_quit_char): Remove warning for using
 	NULL where 0 should be used.
 	* unexmacosx.c: Use malloc/malloc.h on Tiger instead of
-	objc/malloc.h
+	objc/malloc.h.
 	* mac.c: Include time.h for Tiger compatibility.
 
 2004-10-07  Kim F. Storm  <storm@cua.dk>
@@ -12843,7 +12843,7 @@
 	* Makefile.in (msdos.o): Depend on buffer.h, commands.h, and
 	blockinput.h.
 	(dosfns.o): Depend on blockinput.h, window.h, dispextern.h,
-	charset.h, and coding.h
+	charset.h, and coding.h.
 	(w16select.o): Depend on buffer.h, charset.h, coding.h, and composite.h.
 	(term.o): Depend on window.h and keymap.h.
 	(abbrev.o): Depend on syntax.h.
@@ -17222,7 +17222,7 @@
 2003-09-01  Jason Rumney  <jasonr@gnu.org>
 
 	* makefile.w32-in (alloca.o): Remove.
-	(coding.o): Depend on intervals.h
+	(coding.o): Depend on intervals.h.
 	(emacs.o, bytecode.o): Depend on window.h.
 
 2003-09-01  Dave Love  <fx@gnu.org>
@@ -22643,7 +22643,7 @@
 	(Fx_popup_menu): Don't show pop up menu until preceding one is
 	actually cleaned up.  Moved UNGCPRO outside #ifdef HAVE_MENUS block.
 
-	* w32menu.c: Changes adapted from xmenu.c
+	* w32menu.c: Changes adapted from xmenu.c.
 	(set_frame_menubar): First parse all submenus,
 	then make widget_value trees from them.
 	Don't allocate any widget_value objects
@@ -24232,7 +24232,7 @@
 	m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h,
 	m/ibms390.h, m/intel386.h, m/iris4d.h, m/irist.h, m/isi-ov.h,
 	m/m68k.h, m/macppc.h, m/masscomp.h, m/mg1.h, m/mips-siemens.h,
-	m/mips.h, m/news-r6.h, m/news.h, m/next.h, m/nh3000.h, m/nh4000.h
+	m/mips.h, m/news-r6.h, m/news.h, m/next.h, m/nh3000.h, m/nh4000.h,
 	m/ns32000.h, m/orion.h, m/pfa50.h, m/plexus.h, m/pmax.h,
 	m/powerpcle.h, m/pyrmips.h, m/sequent-ptx.h, m/sequent.h,
 	m/sparc.h, m/sr2k.h, m/symmetry.h, m/tad68k.h, m/tahoe.h,
--- a/src/ChangeLog.8	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/ChangeLog.8	Sun Apr 04 21:58:17 2010 +0000
@@ -2886,10 +2886,10 @@
 
 	* sysdep.c: Define numerous routines to emulate Unix system calls.
 
-	* xfaces.c: on MacOS, define the set of colors listed in rgb.txt
+	* xfaces.c: On MacOS, define the set of colors listed in rgb.txt
 	file of an X Window environment.
 
-	* xfaces.c: on MacOS, define the Lisp functions x-display-color-p,
+	* xfaces.c: On MacOS, define the Lisp functions x-display-color-p,
 	x-display-grayscale, x-color-defined-p, and x-color-values.
 
 	* sysdep.c [macintosh] (stat, fstat, mkdir, rmdir, utime, access)
@@ -3160,7 +3160,7 @@
 
 1999-08-25  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
-	* unexelf.c: Merge IRIX debugging info patch from unexsgi.c
+	* unexelf.c: Merge IRIX debugging info patch from unexsgi.c.
 	* m/iris4d.h: Use unexelf for IRIX 5.*.
 	* m/iris5d.h: Use unexelf for IRIX 6.*.
 	* unexsgi.c: Deleted.
@@ -3767,8 +3767,8 @@
 1999-08-06  Gerd Moellmann  <gerd@gnu.org>
 
 	* xdisp.c (compute_line_metrics): If first line's physical ascent
-	 is larger than its logical ascent, use the physical ascent, and
-	 make the row taller.  Set row's overlapping_p flag.
+	is larger than its logical ascent, use the physical ascent, and
+	make the row taller.  Set row's overlapping_p flag.
 
 	* dispnew.c (redraw_overlapping_rows): Use flag overlapping_p.
 	(direct_output_for_insert): Ditto.
@@ -4675,7 +4675,7 @@
 
 1999-06-04  Gerd Moellmann  <gerd@gnu.org>
 
-	* xfaces.c (recompute_basic_faces)[GLYPH_DEBUG]: Check return
+	* xfaces.c (recompute_basic_faces) [GLYPH_DEBUG]: Check return
 	value of realize_basic_faces.
 	(load_face_font_or_fontset): Store full font name in face.
 	(realize_default_face): Use full font name.
@@ -5601,9 +5601,9 @@
 	* window.c (coordinates_in_window): Use CURRENT_MODE_LINE_HEIGHT.
 
 	* xdisp.c (redisplay_window): If mode line height has changed,
-	 arrange for a thorough immediate redisplay using the correct mode
-	 line height.
-	 (window_box_height): Use CURRENT_MODE_LINE_HEIGHT.
+	arrange for a thorough immediate redisplay using the correct mode
+	line height.
+	(window_box_height): Use CURRENT_MODE_LINE_HEIGHT.
 
 	* dispextern.h (MATRIX_MODE_LINE_HEIGHT): New.
 	(CURRENT_MODE_LINE_HEIGHT): New.
@@ -7062,7 +7062,7 @@
 1998-05-04  Gerd Moellmann  <gerd@gnu.org>
 
 	* Makefile.in (LIBXPM): If not already defined, define to -lXpm.
-	(LIBX)[HAVE_X11]: Add LIBXPM.
+	(LIBX) [HAVE_X11]: Add LIBXPM.
 
 	* xfns.c (xpm_image_p): Implementation of image type functions
 	for XPM.
@@ -10052,7 +10052,7 @@
 
 	* xterm.h (WINDOW_COL_PIXEL_X etc.) Removed.
 
-	* dispextern.h (WINDOW_TO_FRAME_HPOS/VPOS): Moved to dispnew.c
+	* dispextern.h (WINDOW_TO_FRAME_HPOS/VPOS): Moved to dispnew.c.
 
 	* xfns.c (x_contour_region): Use pixel coordinates from window
 	cursor instead of WINDOW_TO_FRAME_H/VPOS.
@@ -10897,7 +10897,7 @@
 	(MATRIX_ROW_INVERSE_P): Former MATRIX_ROW_HIGHLIGHT_P.
 	(struct glyph_row): HIGHLIGHT_P -> INVERSE_P
 
-	* all files: use above new names.
+	* all files: Use above new names.
 
 	* dispnew.c (scroll_frame_lines): Simplified.  Use
 	SCROLL_GLYPH_MATRIX.
@@ -10961,7 +10961,7 @@
 	(init_display): Ditto.
 	(syms_of_display): Ditto.
 
-	* dispextern.h: add prototypes for REDRAW_FRAME,
+	* dispextern.h: Add prototypes for REDRAW_FRAME,
 	REDRAW_GARBAGED_FRAMES, CANCEL_LINE, CLEAR_FRAME_RECORDS,
 	INIT_DESIRED_GLYPHS, SCROLL_FRAME_LINES, PRESERVE_OTHER_COLUMNS,
 	ADJUST_WINDOW_CHARSTARTS, CANCEL_MY_COLUMNS,
@@ -11108,9 +11108,9 @@
 	(make_window): Initialize DESIRED_MATRIX and CURRENT_MATRIX.
 	(replace_window): Reset DESIRED_MATRIX and CURRENT_MATRIX
 
-	* Makefile.in (window.o): Add dependency window.c -> dispextern.h
-
-	* window.c: Include dispextern.h
+	* Makefile.in (window.o): Add dependency window.c -> dispextern.h.
+
+	* window.c: Include dispextern.h.
 
 	* scroll.c (do_scrolling): Use new glyphs.
 	(do_direct_scrolling): Ditto.
@@ -11141,9 +11141,9 @@
 	(write_glyphs): Ditto.
 	(insert_glyphs): Ditto.
 
-	* Makefile.in (term.o): term.c depends on dispextern.h
-
-	* term.c: Include dispextern.h
+	* Makefile.in (term.o): term.c depends on dispextern.h.
+
+	* term.c: Include dispextern.h.
 
 	* dispnew.c (direct_output_forward_char): Old glyph functions
 	removed, new inserted.
@@ -11560,8 +11560,8 @@
 1999-05-02  Andrew Innes  <andrewi@gnu.org>
 
 	* s/ms-w32.h (HAVE_FSYNC): New macro.
-	 (fsync): Map to _commit.
-	 (ftruncate): Map to _chsize.
+	(fsync): Map to _commit.
+	(ftruncate): Map to _chsize.
 
 	* w32term.c (dumpglyphs): On Windows NT, do output in Unicode even
 	for ASCII, if enabled, to avoid memory allocation overhead for
@@ -11666,7 +11666,7 @@
 
 	* fontset.c (Fquery_fontset): Don't check for fontset aliases here.
 	(Fnew_fontset, Fset_fontset_font): Check for them here.
-	 (Ffontset_info, Fnew_fontset, Fset_fontset_font):
+	(Ffontset_info, Fnew_fontset, Fset_fontset_font):
 	Fix error message syntax.
 
 	* buffer.c (Fmake_indirect_buffer): Copy multibyte status
@@ -12775,7 +12775,7 @@
 1998-12-06  Eli Zaretskii  <eliz@mescaline.gnu.org>
 
 	* Makefile.in (msdos.o): Depend on termchar.h, charset.h,
-	coding.h, and disptab.h
+	coding.h, and disptab.h.
 
 	* msdos.c (Vdos_unsupported_char_glyph): New variable.
 	(syms_of_msdos): DEFVAR_LISP it.
--- a/src/bidi.c	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/bidi.c	Sun Apr 04 21:58:17 2010 +0000
@@ -1242,7 +1242,7 @@
   if (prev_level < new_level
       && bidi_it->type == WEAK_BN
       && bidi_it->ignore_bn_limit == 0 /* only if not already known */
-      && bidi_it->ch != BIDI_EOB       /* not already at EOB */
+      && bidi_it->bytepos < ZV_BYTE    /* not already at EOB */
       && bidi_explicit_dir_char (FETCH_CHAR (bidi_it->bytepos
 					     + bidi_it->ch_len)))
     {
@@ -1648,7 +1648,7 @@
   if (bidi_it->scan_dir == 1)
     {
       /* There's no sense in trying to advance if we hit end of text.  */
-      if (bidi_it->ch == BIDI_EOB)
+      if (bidi_it->bytepos >= ZV_BYTE)
 	return bidi_it->resolved_level;
 
       /* Record the info about the previous character.  */
--- a/src/ecrt0.c	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/ecrt0.c	Sun Apr 04 21:58:17 2010 +0000
@@ -59,9 +59,7 @@
 
 int data_start = 0;
 
-#ifndef MSDOS
 char **environ;
-#endif
 
 #ifndef static
 /* On systems where the static storage class is usable, this function
@@ -100,70 +98,7 @@
      and optimize it out.  */
   (void) &start1;
 }
-#else /* not CRT0_DUMMIES */
-
-/* This is a kludge.  Now that the CRT0_DUMMIES mechanism above exists,
-   most of these machines could use the vax code above
-   with some suitable definition of CRT0_DUMMIES.
-   Then the symbol m68k could be flushed.
-   But I don't want to risk breaking these machines
-   in a version 17 patch release, so that change is being put off.  */
-
-#ifdef m68k			/* Can't do it all from C */
-	asm ("	global	_start");
-	asm ("	text");
-	asm ("_start:");
-	asm ("  comm	splimit%,4");
-	asm ("	global	exit");
-	asm ("	text");
-  	asm ("	mov.l	%d0,splimit%");
-	asm ("	jsr	start1");
-	asm ("	mov.l	%d0,(%sp)");
-	asm ("	jsr	exit");
-	asm ("	mov.l	&1,%d0");	/* d0 = 1 => exit */
-	asm ("	trap	&0");
-
-/* ignore takes care of skipping the a6 value pushed in start.  */
-static
-start1 (argc, xargv)
-     int argc;
-     char *xargv;
-{
-  register char **argv = &xargv;
-  environ = argv + argc + 1;
-
-  if ((char *)environ == xargv)
-    environ--;
-  exit (main (argc, argv, environ));
-}
-
-#endif /* m68k */
-
-#endif /* not CRT0_DUMMIES */
-
-#ifdef __sparc__
-asm (".global __start");
-asm (".text");
-asm ("__start:");
-asm ("	mov	0, %fp");
-asm ("	ld	[%sp + 64], %o0");
-asm ("	add	%sp, 68, %o1");
-asm ("	sll	%o0, 2,	%o2");
-asm ("	add	%o2, 4,	%o2");
-asm ("	add	%o1, %o2, %o2");
-asm ("	sethi	%hi(_environ), %o3");
-asm ("	st	%o2, [%o3+%lo(_environ)]");
-asm ("	andn	%sp, 7,	%sp");
-asm ("	call	_main");
-asm ("	sub	%sp, 24, %sp");
-asm ("	call	__exit");
-asm ("	nop");
-
-#endif /* __sparc__ */
-
-#if __FreeBSD__ == 2
-char *__progname;
-#endif
+#endif /* CRT0_DUMMIES */
 
 /* arch-tag: 4025c2fb-d6b1-4d29-b1b6-8100b6bd1e74
    (do not change this comment) */
--- a/src/m/intel386.h	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/m/intel386.h	Sun Apr 04 21:58:17 2010 +0000
@@ -85,10 +85,6 @@
 #define TEXT_START 0
 #endif /* USG */
 
-#ifdef MSDOS
-#define NO_REMAP
-#endif
-
 #ifdef WINDOWSNT
 #define VIRT_ADDR_VARIES
 #define DATA_START 	get_data_start ()
--- a/src/m/vax.h	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/m/vax.h	Sun Apr 04 21:58:17 2010 +0000
@@ -34,10 +34,6 @@
 
 /* #define vax    -- appears to be done automatically  */
 
-/* crt0.c should use the vax-bsd style of entry, with no dummy args.  */
-
-#define CRT0_DUMMIES
-
 /* USG systems I know of running on Vaxes do not actually
    support the load average, so disable it for them.  */
 
--- a/src/s/msdos.h	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/s/msdos.h	Sun Apr 04 21:58:17 2010 +0000
@@ -170,5 +170,7 @@
 #define GC_SETJMP_WORKS 1
 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
 
+#define NO_REMAP
+
 /* arch-tag: d184f860-815d-4ff4-8187-d05c0f3c37d0
    (do not change this comment) */
--- a/src/w32fns.c	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/w32fns.c	Sun Apr 04 21:58:17 2010 +0000
@@ -5427,6 +5427,10 @@
 
   kb = dpyinfo->terminal->kboard;
 
+  /* The calls to x_get_arg remove elements from PARMS, so copy it to
+     avoid destructive changes behind our caller's back.  */
+  parms = Fcopy_alist (parms);
+
   /* Get the name of the frame to use for resource lookup.  */
   name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", RES_TYPE_STRING);
   if (!STRINGP (name)
--- a/src/xdisp.c	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/xdisp.c	Sun Apr 04 21:58:17 2010 +0000
@@ -6570,7 +6570,10 @@
 /* Scan forward from CHARPOS in the current buffer, until we find a
    stop position > current IT's position.  Then handle the stop
    position before that.  This is called when we bump into a stop
-   position while reordering bidirectional text.  */
+   position while reordering bidirectional text.  CHARPOS should be
+   the last previously processed stop_pos (or BEGV, if none were
+   processed yet) whose position is less that IT's current
+   position.  */
 
 static void
 handle_stop_backwards (it, charpos)
--- a/src/xfns.c	Fri Apr 02 11:36:10 2010 +0000
+++ b/src/xfns.c	Sun Apr 04 21:58:17 2010 +0000
@@ -203,6 +203,10 @@
 
 extern Lisp_Object Vwindow_system_version;
 
+/* In editfns.c */
+
+extern Lisp_Object Vsystem_name;
+
 /* The below are defined in frame.c.  */
 
 #if GLYPH_DEBUG
@@ -3145,6 +3149,37 @@
   return Qnil;
 }
 
+static void
+set_machine_and_pid_properties (struct frame *f)
+{
+  /* See the above comment "Note: Encoding strategy".  */
+  XTextProperty text;
+  int bytes, stringp;
+  int do_free_text_value = 0;
+  long pid = (long)getpid();
+
+  text.value = x_encode_text (Vsystem_name,
+                              Qcompound_text, 0, &bytes, &stringp,
+                              &do_free_text_value);
+  text.encoding = (stringp ? XA_STRING
+                   : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
+  text.format = 8;
+  text.nitems = bytes;
+  XSetWMClientMachine (FRAME_X_DISPLAY (f),
+                       FRAME_OUTER_WINDOW (f),
+                       &text);
+  if (do_free_text_value)
+    xfree (text.value);
+
+  XChangeProperty (FRAME_X_DISPLAY (f),
+                   FRAME_OUTER_WINDOW (f),
+                   XInternAtom (FRAME_X_DISPLAY (f),
+                                "_NET_WM_PID",
+                                False),
+                   XA_CARDINAL, 32, PropModeReplace,
+                   (unsigned char *) &pid, 1);
+}
+
 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
        1, 1, 0,
        doc: /* Make a new X window, which is called a "frame" in Emacs terms.
@@ -3531,19 +3566,24 @@
 	;
     }
 
+  BLOCK_INPUT;
+                       
+  /* Set machine name and pid for the purpose of window managers.  */
+  set_machine_and_pid_properties(f);
+
   /* Set the WM leader property.  GTK does this itself, so this is not
      needed when using GTK.  */
   if (dpyinfo->client_leader_window != 0)
     {
-      BLOCK_INPUT;
       XChangeProperty (FRAME_X_DISPLAY (f),
                        FRAME_OUTER_WINDOW (f),
                        dpyinfo->Xatom_wm_client_leader,
                        XA_WINDOW, 32, PropModeReplace,
                        (unsigned char *) &dpyinfo->client_leader_window, 1);
-      UNBLOCK_INPUT;
     }
 
+  UNBLOCK_INPUT;
+
   /* Initialize `default-minibuffer-frame' in case this is the first
      frame on this terminal.  */
   if (FRAME_HAS_MINIBUF_P (f)