changeset 108684:94ded30ef2ab

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Tue, 18 May 2010 22:45:34 +0000
parents f4ea12190bdf (current diff) fe3c51344472 (diff)
children 391df511b305
files
diffstat 25 files changed, 570 insertions(+), 181 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon May 17 22:44:26 2010 +0000
+++ b/ChangeLog	Tue May 18 22:45:34 2010 +0000
@@ -1,3 +1,15 @@
+2010-05-18  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (POST_ALLOC_OBJ) [cygwin]: Omit vm-limit.o.
+	(POST_ALLOC_OBJ) [!cygwin]: Set to empty.
+
+	* config.bat (RALLOC_OBJ): Edit to empty if sys_malloc.
+	* configure.in (REL_ALLOC): Unset on gnu, gnu-linux if DOUG_LEA_MALLOC.
+	(RALLOC_OBJ): New output variable.
+
+	* config.bat (GMALLOC_OBJ, VMLIMIT_OBJ): Edit to empty if sys_malloc.
+	* configure.in (GMALLOC_OBJ, VMLIMIT_OBJ): New output variables.
+
 2010-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* Makefile.in (src): Provide the name of the VCS file that witnesses
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/admin/notes/bzr	Tue May 18 22:45:34 2010 +0000
@@ -0,0 +1,40 @@
+NOTES ON COMMITTING TO EMACS'S BAZAAR REPO    -*- outline -*-
+
+* Install changes only on one branch, let them get merged elsewhere if needed.
+In particular, install bug-fixes only on the release branch (if there
+is one) and let them get synced to the trunk; do not install them by
+hand on the trunk as well.  E.g. if there is an active "emacs-23" branch
+and you have a bug-fix appropriate for the next Emacs-23.x release,
+install it only on the emacs-23 branch, not on the trunk as well.
+
+Installing things manually into more than one branch makes merges more
+difficult.
+
+http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01124.html
+
+* Backporting a bug-fix from the trunk to a branch (e.g. "emacs-23").
+Label the commit as a backport, e.g. by starting the commit message with
+"Backport:".  This is helpful for the person merging the release branch
+to the trunk.
+
+http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00262.html
+
+* Installing changes from your personal branches.
+If your branch has only a single commit, or many different real
+commits, it is fine to do a merge.  If your branch has only a very
+small number of "real" commits, but several "merge from trunks", it is
+preferred that you take your branch's diff, apply it to the trunk, and
+commit directly, not merge.  This keeps the history cleaner.
+
+In general, when working on some feature in a separate branch, it is
+preferable not to merge from trunk until you are done with the
+feature.  Unless you really need some change that was done on the
+trunk while you were developing on the branch, you don't really need
+those merges; just merge once, when you are done with the feature, and
+Bazaar will take care of the rest.  Bazaar is much better in this than
+CVS, so interim merges are unnecessary.
+
+Or use shelves; or rebase; or do something else.  See the thread for
+yet another fun excursion into the exciting world of version control.
+
+http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00086.html
--- a/config.bat	Mon May 17 22:44:26 2010 +0000
+++ b/config.bat	Tue May 18 22:45:34 2010 +0000
@@ -201,6 +201,13 @@
 rm -f makefile.tmp
 :src5
 
+if "%sys_malloc%" == "" goto src5a
+sed -e "/^GMALLOC_OBJ *=/s/gmalloc.o//" <Makefile >makefile.tmp
+sed -e "/^VMLIMIT_OBJ *=/s/vm-limit.o//" <makefile.tmp >makefile.tmp2
+sed -e "/^RALLOC_OBJ *=/s/ralloc.o//" <makefile.tmp2 >Makefile
+rm -f makefile.tmp makefile.tmp2
+:src5a
+
 if "%nodebug%" == "" goto src6
 sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp
 sed -e "/^LDFLAGS *=/s/=/=-s/" <makefile.tmp >Makefile
--- a/configure	Mon May 17 22:44:26 2010 +0000
+++ b/configure	Tue May 18 22:45:34 2010 +0000
@@ -724,6 +724,8 @@
 NS_SUPPORT
 LIB_STANDARD
 HAVE_XSERVER
+GMALLOC_OBJ
+VMLIMIT_OBJ
 RSVG_CFLAGS
 RSVG_LIBS
 GTK_CFLAGS
@@ -810,6 +812,7 @@
 LIBXMENU
 LIBX_OTHER
 OLDXMENU_DEPS
+RALLOC_OBJ
 CYGWIN_OBJ
 PRE_ALLOC_OBJ
 POST_ALLOC_OBJ
@@ -10513,11 +10516,20 @@
 if test $emacs_cv_var___after_morecore_hook = no; then
   doug_lea_malloc=no
 fi
+
 if test "${system_malloc}" = "yes"; then
   GNU_MALLOC=no
   GNU_MALLOC_reason="
     (The GNU allocators don't work with this system configuration.)"
-fi
+  GMALLOC_OBJ=
+  VMLIMIT_OBJ=
+else
+  test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
+  VMLIMIT_OBJ=vm-limit.o
+fi
+
+
+
 if test "$doug_lea_malloc" = "yes" ; then
   if test "$GNU_MALLOC" = yes ; then
     GNU_MALLOC_reason="
@@ -10528,6 +10540,14 @@
 #define DOUG_LEA_MALLOC 1
 _ACEOF
 
+
+  ## Use mmap directly for allocating larger buffers.
+  ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
+  ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
+  ## Does the AC_FUNC_MMAP test below make this check unecessary?
+  case "$opsys" in
+    gnu*) REL_ALLOC=no ;;
+  esac
 fi
 
 if test x"${REL_ALLOC}" = x; then
@@ -26520,6 +26540,7 @@
 _ACEOF
 
 fi
+
 if test "${GNU_MALLOC}" = "yes" ; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -26527,12 +26548,16 @@
 _ACEOF
 
 fi
+
+RALLOC_OBJ=
 if test "${REL_ALLOC}" = "yes" ; then
 
 cat >>confdefs.h <<\_ACEOF
 #define REL_ALLOC 1
 _ACEOF
 
+
+  test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
 fi
 
 
@@ -26540,11 +26565,11 @@
   CYGWIN_OBJ="sheap.o"
   ## Cygwin differs because of its unexec().
   PRE_ALLOC_OBJ=
-  POST_ALLOC_OBJ="lastfile.o vm-limit.o"
+  POST_ALLOC_OBJ=lastfile.o
 else
   CYGWIN_OBJ=
   PRE_ALLOC_OBJ=lastfile.o
-  POST_ALLOC_OBJ="\$(vmlimitobj)"
+  POST_ALLOC_OBJ=
 fi
 
 
--- a/configure.in	Mon May 17 22:44:26 2010 +0000
+++ b/configure.in	Tue May 18 22:45:34 2010 +0000
@@ -1592,11 +1592,20 @@
 if test $emacs_cv_var___after_morecore_hook = no; then
   doug_lea_malloc=no
 fi
+
 if test "${system_malloc}" = "yes"; then
   GNU_MALLOC=no
   GNU_MALLOC_reason="
     (The GNU allocators don't work with this system configuration.)"
+  GMALLOC_OBJ=
+  VMLIMIT_OBJ=
+else
+  test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
+  VMLIMIT_OBJ=vm-limit.o
 fi
+AC_SUBST(GMALLOC_OBJ)
+AC_SUBST(VMLIMIT_OBJ)
+
 if test "$doug_lea_malloc" = "yes" ; then
   if test "$GNU_MALLOC" = yes ; then
     GNU_MALLOC_reason="
@@ -1604,6 +1613,14 @@
   fi
   AC_DEFINE(DOUG_LEA_MALLOC, 1,
 	    [Define to 1 if you are using the GNU C Library.])
+
+  ## Use mmap directly for allocating larger buffers.
+  ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
+  ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
+  ## Does the AC_FUNC_MMAP test below make this check unecessary?
+  case "$opsys" in
+    gnu*) REL_ALLOC=no ;;
+  esac
 fi
 
 if test x"${REL_ALLOC}" = x; then
@@ -3189,26 +3206,31 @@
 	     (This is automatic if you use X, but the option to specify it remains.)
 	     It is also defined with other window systems that support xmenu.c.])
 fi
+
 if test "${GNU_MALLOC}" = "yes" ; then
   AC_DEFINE(GNU_MALLOC, 1,
 	    [Define to 1 if you want to use the GNU memory allocator.])
 fi
+
+RALLOC_OBJ=
 if test "${REL_ALLOC}" = "yes" ; then
   AC_DEFINE(REL_ALLOC, 1,
 	    [Define REL_ALLOC if you want to use the relocating allocator for
 	     buffer space.])
+
+  test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
 fi
-
+AC_SUBST(RALLOC_OBJ)
 
 if test "$opsys" = "cygwin"; then
   CYGWIN_OBJ="sheap.o"
   ## Cygwin differs because of its unexec().
   PRE_ALLOC_OBJ=
-  POST_ALLOC_OBJ="lastfile.o vm-limit.o"
+  POST_ALLOC_OBJ=lastfile.o
 else
   CYGWIN_OBJ=
   PRE_ALLOC_OBJ=lastfile.o
-  POST_ALLOC_OBJ="\$(vmlimitobj)"
+  POST_ALLOC_OBJ=
 fi
 AC_SUBST(CYGWIN_OBJ)
 AC_SUBST(PRE_ALLOC_OBJ)
--- a/doc/emacs/ChangeLog	Mon May 17 22:44:26 2010 +0000
+++ b/doc/emacs/ChangeLog	Tue May 18 22:45:34 2010 +0000
@@ -1,3 +1,12 @@
+2010-05-18  Eli Zaretskii  <eliz@gnu.org>
+
+	* display.texi (Fringes): Document reversal of fringe arrows for R2L
+	paragraphs.
+	(Line Truncation): Fix wording for bidi display.
+
+	* basic.texi (Moving Point): Document bidi-aware behavior of the arrow
+	keys.
+
 2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
 
 	* building.texi (GDB Graphical Interface): Remove misleading comparison
@@ -127,7 +136,7 @@
 
 	* custom.texi (Init Examples): Add xref to Mail Header.
 
-	* emacs.texi (Top):  Fix xrefs.
+	* emacs.texi (Top): Fix xrefs.
 
 2010-03-30  Chong Yidong  <cyd@stupidchicken.com>
 
@@ -1695,7 +1704,7 @@
 	(Fortran Columns): Mention font-locking.
 	(Fortran Abbrev): Word syntax not relevant with new-style abbrev.
 
-2008-08-23  Johan Bockgard  <bojohan@muon>
+2008-08-23  Johan Bockgård  <bojohan@muon>
 
 	* basic.texi (Moving Point): Fix <prior>/<next> confusion.
 
--- a/doc/emacs/basic.texi	Mon May 17 22:44:26 2010 +0000
+++ b/doc/emacs/basic.texi	Tue May 18 22:45:34 2010 +0000
@@ -146,6 +146,8 @@
 @findex move-end-of-line
 @findex forward-char
 @findex backward-char
+@findex right-arrow-command
+@findex left-arrow-command
 @findex next-line
 @findex previous-line
 @findex beginning-of-buffer
@@ -161,11 +163,19 @@
 @itemx @key{End}
 Move to the end of the line (@code{move-end-of-line}).
 @item C-f
-@itemx @key{right}
 Move forward one character (@code{forward-char}).
+@item @key{right}
+Move one character to the right (@code{right-arrow-command}).  This
+moves one character forward in text that is read in the usual
+left-to-right direction, but one character @emph{backward} if the text
+is read right-to-left, as needed for right-to-left scripts such as
+Arabic.  @xref{Bidirectional Editing}.
 @item C-b
-@itemx @key{left}
 Move backward one character (@code{backward-char}).
+@item @key{left}
+Move one character to the left (@code{left-arrow-command}).  This
+moves one character backward in left-to-right text and one character
+forward in right-to-left text.
 @item M-f
 @itemx M-@key{right}
 @itemx C-@key{right}
--- a/doc/emacs/display.texi	Mon May 17 22:44:26 2010 +0000
+++ b/doc/emacs/display.texi	Tue May 18 22:45:34 2010 +0000
@@ -804,7 +804,10 @@
 screen.  The left fringe shows a curving arrow for each screen line
 except the first, indicating that ``this is not the real beginning.''
 The right fringe shows a curving arrow for each screen line except the
-last, indicating that ``this is not the real end.''
+last, indicating that ``this is not the real end.''  If the line's
+direction is right-to-left (@pxref{Bidirectional Editing}), the
+meaning of the curving arrows in the left and right fringes are
+swapped.
 
   The fringes indicate line truncation with short horizontal arrows
 meaning ``there's more text on this line which is scrolled
@@ -1191,8 +1194,8 @@
 characters that do not fit in the width of the screen or window do not
 appear at all.  On graphical displays, a small straight arrow in the
 fringe indicates truncation at either end of the line.  On text-only
-terminals, @samp{$} appears in the first column when there is text
-truncated to the left, and in the last column when there is text
+terminals, @samp{$} appears in the leftmost column when there is text
+truncated to the left, and in the rightmost column when there is text
 truncated to the right.
 
 @vindex truncate-lines
--- a/etc/NEWS	Mon May 17 22:44:26 2010 +0000
+++ b/etc/NEWS	Tue May 18 22:45:34 2010 +0000
@@ -214,7 +214,9 @@
 
 ** secrets.el is an implementation of the Secret Service API, an
 interface to password managers like GNOME Keyring or KDE Wallet.  The
-Secret Service API requires D-Bus for communication.
+Secret Service API requires D-Bus for communication.  The command
+`secrets-show-secrets' offers a buffer with a visualization of the
+secrets.
 
 
 * Incompatible Lisp Changes in Emacs 24.1
--- a/lisp/ChangeLog	Mon May 17 22:44:26 2010 +0000
+++ b/lisp/ChangeLog	Tue May 18 22:45:34 2010 +0000
@@ -1,3 +1,41 @@
+2010-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* subr.el (read-quoted-char): Resolve modifiers after key
+	remapping (bug#6212).
+
+2010-05-18  Michael Albinus  <michael.albinus@gmx.de>
+
+	Add visualization code for secrets.
+	* net/secrets.el (secrets-mode): New major mode.
+	(secrets-show-secrets, secrets-show-collections)
+	(secrets-expand-collection, secrets-expand-item)
+	(secrets-tree-widget-after-toggle-function)
+	(secrets-tree-widget-show-password): New defuns.
+
+2010-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/smie.el (smie-next-sexp): Break inf-loop at BOB.
+	(smie-backward-sexp, smie-forward-sexp): Remove boundary condition now
+	handled in smie-next-sexp.
+	(smie-indent-calculate): Provide a starting indentation (so the
+	recursion is well-founded ;-).
+
+	Fix handling of non-associative equal levels.
+	* emacs-lisp/smie.el (smie-prec2-levels): Choose distinct levels even
+	when it's not needed.
+	(smie-op-left, smie-op-right): New functions.
+	(smie-next-sexp): New function, extracted from smie-backward-sexp.
+	Better handle equal levels to distinguish the associative case from
+	the "multi-keyword construct" case.
+	(smie-backward-sexp, smie-forward-sexp): Use it.
+
+2010-05-18  Juanma Barranquero  <lekktu@gmail.com>
+
+	* progmodes/prolog.el (smie-indent-basic): Declare for byte-compiler.
+
+	* emacs-lisp/smie.el (smie-precs-precedence-table, smie-backward-sexp)
+	(smie-forward-sexp, smie-indent-calculate): Fix typos in docstrings.
+
 2010-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	Provide a simple generic indentation engine and use it for Prolog.
@@ -9,7 +47,7 @@
 
 2010-05-17  Jay Belanger  <jay.p.belanger@gmail.com>
 
-	* calc/calc-vec.el (math-vector-avg):  Put the vector elements in
+	* calc/calc-vec.el (math-vector-avg): Put the vector elements in
 	order before computing the averages.
 
 2010-05-16  Jay Belanger  <jay.p.belanger@gmail.com>
@@ -18,7 +56,7 @@
 	(calcFunc-histogram): Allow vectors as inputs.
 	(math-vector-avg): New function.
 
-	* calc/calc-ext.el (math-group-float):  Have the number of digits
+	* calc/calc-ext.el (math-group-float): Have the number of digits
 	being grouped depend on the radix (Bug#6189).
 
 2010-05-15  Ken Raeburn  <raeburn@raeburn.org>
@@ -64,9 +102,9 @@
 	* calc/calc-units.el (calc-explain-units-rec): Allow Greek letters.
 
 	* calc/calc.el (var-π, var-φ, var-γ): New variables.
-	* calc/calc-aent.el (math-read-replacement-list):  Add "micro" symbol.
+	* calc/calc-aent.el (math-read-replacement-list): Add "micro" symbol.
 	* calc/calc-units.el (math-unit-prefixes): Add mu for micro.
-	(math-standard-units):  Add units.
+	(math-standard-units): Add units.
 
 2010-05-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
@@ -111,8 +149,7 @@
 
 2010-05-13  Chong Yidong  <cyd@stupidchicken.com>
 
-	Add TeX open-block and close-block keybindings to SGML, and vice
-	versa.
+	Add TeX open-block and close-block keybindings to SGML, and vice versa.
 
 	* textmodes/tex-mode.el (tex-mode-map): Bind C-c C-t to
 	latex-open-block and C-c / to latex-close-block.
@@ -123,7 +160,7 @@
 2010-05-13  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/tramp.el (with-progress-reporter): Create reporter object
-	only when the message would be displayed.  Handled nested calls.
+	only when the message would be displayed.  Handle nested calls.
 	(tramp-handle-load, tramp-handle-file-local-copy)
 	(tramp-handle-insert-file-contents, tramp-handle-write-region)
 	(tramp-maybe-send-script, tramp-find-shell):
@@ -418,7 +455,7 @@
 
 	* Version 23.2 released.
 
-2010-05-07  Deniz Dogan <deniz.a.m.dogan@gmail.com>  (tiny change)
+2010-05-07  Deniz Dogan  <deniz.a.m.dogan@gmail.com>  (tiny change)
             Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	Highlight vendor specific properties.
@@ -439,7 +476,7 @@
 	* simple.el (auto-save-mode): Move from files.el.
 	* minibuffer.el (completion--common-suffix): Fix copy&paste error.
 
-2010-05-07  Christian von Roques <roques@mti.ag> (tiny change)
+2010-05-07  Christian von Roques  <roques@mti.ag>  (tiny change)
 
 	* lisp/epg.el (epg-key-capablity-alist): Add "D" flag (Bug#5592).
 
--- a/lisp/emacs-lisp/smie.el	Mon May 17 22:44:26 2010 +0000
+++ b/lisp/emacs-lisp/smie.el	Tue May 18 22:45:34 2010 +0000
@@ -86,7 +86,7 @@
 PRECS should be a list, sorted by precedence (e.g. \"+\" will
 come before \"*\"), of elements of the form \(left OP ...)
 or (right OP ...) or (nonassoc OP ...)  or (assoc OP ...).  All operators in
-one of those elements shares the same precedence level and associativity."
+one of those elements share the same precedence level and associativity."
   (let ((prec2-table (make-hash-table :test 'equal)))
     (dolist (prec precs)
       (dolist (op (cdr prec))
@@ -252,11 +252,23 @@
           (dolist (cst csts)
             (unless (memq (car cst) rhvs)
               (setq progress t)
+              ;; We could give each var in a given iteration the same value,
+              ;; but we can also give them arbitrarily different values.
+              ;; Basically, these are vars between which there is no
+              ;; constraint (neither equality nor inequality), so
+              ;; anything will do.
+              ;; We give them arbitrary values, which means that we
+              ;; replace the "no constraint" case with either > or <
+              ;; but not =.  The reason we do that is so as to try and
+              ;; distinguish associative operators (which will have
+              ;; left = right).
+              (unless (caar cst)
               (setcar (car cst) i)
+                (incf i))
               (setq csts (delq cst csts))))
           (unless progress
             (error "Can't resolve the precedence table to precedence levels")))
-        (incf i))
+        (incf i 10))
       ;; Propagate equalities back to their source.
       (dolist (eq (nreverse eqs))
         (assert (null (caar eq)))
@@ -278,6 +290,9 @@
 Each element is of the form (TOKEN LEFT-LEVEL RIGHT-LEVEL).
 Parsing is done using an operator precedence parser.")
 
+(defalias 'smie-op-left 'car)
+(defalias 'smie-op-right 'cadr)
+
 (defun smie-backward-token ()
   ;; FIXME: This may be an OK default but probably needs a hook.
   (buffer-substring (point)
@@ -292,6 +307,92 @@
                                (skip-syntax-forward "w_'"))
                            (point))))
 
+(defun smie-associative-p (toklevels)
+  ;; in "a + b + c" we want to stop at each +, but in
+  ;; "if a then b else c" we don't want to stop at each keyword.
+  ;; To distinguish the two cases, we made smie-prec2-levels choose
+  ;; different levels for each part of "if a then b else c", so that
+  ;; by checking if the left-level is equal to the right level, we can
+  ;; figure out that it's an associative operator.
+  ;; This is not 100% foolproof, tho, since a grammar like
+  ;;   (exp ("A" exp "C") ("A" exp "B" exp "C"))
+  ;; will cause "B" to have equal left and right levels, even though
+  ;; it is not an associative operator.
+  ;; A better check would be the check the actual previous operator
+  ;; against this one to see if it's the same, but we'd have to change
+  ;; `levels' to keep a stack of operators rather than only levels.
+  (eq (smie-op-left toklevels) (smie-op-right toklevels)))
+
+(defun smie-next-sexp (next-token next-sexp op-forw op-back halfsexp)
+  "Skip over one sexp.
+NEXT-TOKEN is a function of no argument that moves forward by one
+token (after skipping comments if needed) and returns it.
+NEXT-SEXP is a lower-level function to skip one sexp.
+OP-FORW is the accessor to the forward level of the level data.
+OP-BACK is the accessor to the backward level of the level data.
+HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
+first token we see is an operator, skip over its left-hand-side argument.
+Possible return values:
+  (FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level
+    is too high.  FORW-LEVEL is the forw-level of TOKEN,
+    POS is its start position in the buffer.
+  (t POS TOKEN): same thing when we bump on the wrong side of a paren.
+  (nil POS TOKEN): we skipped over a paren-like pair.
+  nil: we skipped over an identifier, matched parentheses, ..."
+  (catch 'return
+    (let ((levels ()))
+      (while
+          (let* ((pos (point))
+                 (token (funcall next-token))
+                 (toklevels (cdr (assoc token smie-op-levels))))
+
+            (cond
+             ((null toklevels)
+              (when (equal token "")
+                  (condition-case err
+                      (progn (goto-char pos) (funcall next-sexp 1) nil)
+                  (scan-error (throw 'return (list t (caddr err)))))
+                (if (eq pos (point))
+                    ;; We did not move, so let's abort the loop.
+                    (throw 'return (list t (point))))))
+             ((null (funcall op-back toklevels))
+              ;; A token like a paren-close.
+              (assert (funcall op-forw toklevels)) ;Otherwise, why mention it?
+              (push (funcall op-forw toklevels) levels))
+             (t
+              (while (and levels (< (funcall op-back toklevels) (car levels)))
+                (setq levels (cdr levels)))
+              (cond
+               ((null levels)
+                (if (and halfsexp (funcall op-forw toklevels))
+                    (push (funcall op-forw toklevels) levels)
+                  (throw 'return
+                         (prog1 (list (or (car toklevels) t) (point) token)
+                           (goto-char pos)))))
+               (t
+                (if (and levels (= (funcall op-back toklevels) (car levels)))
+                    (setq levels (cdr levels)))
+                (cond
+                 ((null levels)
+                  (cond
+                   ((null (funcall op-forw toklevels))
+                    (throw 'return (list nil (point) token)))
+                   ((smie-associative-p toklevels)
+                    (throw 'return
+                           (prog1 (list (or (car toklevels) t) (point) token)
+                             (goto-char pos))))
+                   ;; We just found a match to the previously pending operator
+                   ;; but this new operator is still part of a larger RHS.
+                   ;; E.g. we're now looking at the "then" in
+                   ;; "if a then b else c".  So we have to keep parsing the
+                   ;; rest of the construct.
+                   (t (push (funcall op-forw toklevels) levels))))
+                 (t
+                  (if (funcall op-forw toklevels)
+                      (push (funcall op-forw toklevels) levels))))))))
+            levels)
+        (setq halfsexp nil)))))
+
 (defun smie-backward-sexp (&optional halfsexp)
   "Skip over one sexp.
 HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
@@ -300,58 +401,16 @@
   (LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level
     is too high.  LEFT-LEVEL is the left-level of TOKEN,
     POS is its start position in the buffer.
-  (t POS TOKEN): Same thing but for an open-paren or the beginning of buffer.
+  (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
-  (if (bobp) (list t (point))
-    (catch 'return
-      (let ((levels ()))
-        (while
-            (let* ((pos (point))
-                   (token (progn (forward-comment (- (point-max)))
-                                 (smie-backward-token)))
-                   (toklevels (cdr (assoc token smie-op-levels))))
-      
-              (cond
-               ((null toklevels)
-                (if (equal token "")
-                    (condition-case err
-                        (progn (goto-char pos) (backward-sexp 1) nil)
-                      (scan-error (throw 'return (list t (caddr err)))))))
-               ((null (nth 1 toklevels))
-                ;; A token like a paren-close.
-                (assert (nth 0 toklevels)) ;Otherwise, why mention it?
-                (push (nth 0 toklevels) levels))
-               (t
-                (while (and levels (< (nth 1 toklevels) (car levels)))
-                  (setq levels (cdr levels)))
-                (cond
-                 ((null levels)
-                  (if (and halfsexp (nth 0 toklevels))
-                      (push (nth 0 toklevels) levels)
-                    (throw 'return
-                           (prog1 (list (or (car toklevels) t) (point) token)
-                             (goto-char pos)))))
-                 (t
-                  (while (and levels (= (nth 1 toklevels) (car levels)))
-                    (setq levels (cdr levels)))
-                  (cond
-                   ((null levels)
-                    (cond
-                     ((null (nth 0 toklevels))
-                      (throw 'return (list nil (point) token)))
-                     ((eq (nth 0 toklevels) (nth 1 toklevels))
-                      (throw 'return
-                             (prog1 (list (or (car toklevels) t) (point) token)
-                               (goto-char pos))))
-                     (t (debug))))      ;Not sure yet what to do here.
-                   (t
-                    (if (nth 0 toklevels)
-                        (push (nth 0 toklevels) levels))))))))
-              levels)
-          (setq halfsexp nil))))))
+    (smie-next-sexp
+     (lambda () (forward-comment (- (point-max))) (smie-backward-token))
+     (indirect-function 'backward-sexp)
+     (indirect-function 'smie-op-left)
+     (indirect-function 'smie-op-right)
+   halfsexp))
 
-;; Mirror image, not used for indentation.
 (defun smie-forward-sexp (&optional halfsexp)
   "Skip over one sexp.
 HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
@@ -360,56 +419,15 @@
   (RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level
     is too high.  RIGHT-LEVEL is the right-level of TOKEN,
     POS is its end position in the buffer.
-  (t POS TOKEN): Same thing but for an open-paren or the beginning of buffer.
+  (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
-  (if (eobp) (list t (point))
-    (catch 'return
-      (let ((levels ()))
-        (while
-            (let* ((pos (point))
-                   (token (progn (forward-comment (point-max))
-                                 (smie-forward-token)))
-                   (toklevels (cdr (assoc token smie-op-levels))))
-      
-              (cond
-               ((null toklevels)
-                (if (equal token "")
-                    (condition-case err
-                        (progn (goto-char pos) (forward-sexp 1) nil)
-                      (scan-error (throw 'return (list t (caddr err)))))))
-               ((null (nth 0 toklevels))
-                ;; A token like a paren-close.
-                (assert (nth 1 toklevels)) ;Otherwise, why mention it?
-                (push (nth 1 toklevels) levels))
-               (t
-                (while (and levels (< (nth 0 toklevels) (car levels)))
-                  (setq levels (cdr levels)))
-                (cond
-                 ((null levels)
-                  (if (and halfsexp (nth 1 toklevels))
-                      (push (nth 1 toklevels) levels)
-                    (throw 'return
-                           (prog1 (list (or (nth 1 toklevels) t) (point) token)
-                             (goto-char pos)))))
-                 (t
-                  (while (and levels (= (nth 0 toklevels) (car levels)))
-                    (setq levels (cdr levels)))
-                  (cond
-                   ((null levels)
-                    (cond
-                     ((null (nth 1 toklevels))
-                      (throw 'return (list nil (point) token)))
-                     ((eq (nth 1 toklevels) (nth 0 toklevels))
-                      (throw 'return
-                             (prog1 (list (or (nth 1 toklevels) t) (point) token)
-                               (goto-char pos))))
-                     (t (debug))))      ;Not sure yet what to do here.
-                   (t
-                    (if (nth 1 toklevels)
-                        (push (nth 1 toklevels) levels))))))))
-              levels)
-          (setq halfsexp nil))))))
+    (smie-next-sexp
+     (lambda () (forward-comment (point-max)) (smie-forward-token))
+     (indirect-function 'forward-sexp)
+     (indirect-function 'smie-op-right)
+     (indirect-function 'smie-op-left)
+   halfsexp))
 
 (defun smie-backward-sexp-command (&optional n)
   "Move backward through N logical elements."
@@ -485,7 +503,7 @@
 in order to figure out the indentation of some other (further down) point.
 VIRTUAL can take two different non-nil values:
 - :bolp: means that the current indentation of point can be trusted
-  to be good only if if it follows a line break.
+  to be good only if it follows a line break.
 - :hanging: means that the current indentation of point can be
   trusted to be good except if the following token is hanging."
   ;; FIXME: This has accumulated a lot of rules, some of which aren't
@@ -496,6 +514,10 @@
    (and virtual
         (if (eq virtual :hanging) (not (smie-indent-hanging-p)) (smie-bolp))
         (current-column))
+   ;; Start the file at column 0.
+   (save-excursion
+     (forward-comment (- (point-max)))
+     (if (bobp) 0))
    ;; Align close paren with opening paren.
    (save-excursion
      ;; (forward-comment (point-max))
--- a/lisp/net/secrets.el	Mon May 17 22:44:26 2010 +0000
+++ b/lisp/net/secrets.el	Tue May 18 22:45:34 2010 +0000
@@ -129,6 +129,9 @@
 ;;   (secrets-search-items "session" :user "joe")
 ;;    => ("my item" "another item")
 
+;; Interactively, collections, items and their attributes could be
+;; inspected by the command `secrets-show-secrets'.
+
 ;;; Code:
 
 ;; It has been tested with GNOME Keyring 2.29.92.  An implementation
@@ -148,6 +151,13 @@
 
 (require 'dbus)
 
+(declare-function tree-widget-set-theme "tree-widget")
+(declare-function widget-create-child-and-convert "wid-edit")
+(declare-function widget-default-value-set "wid-edit")
+(declare-function widget-field-end "wid-edit")
+(declare-function widget-member "wid-edit")
+(defvar tree-widget-after-toggle-functions)
+
 (defvar secrets-enabled nil
   "Whether there is a daemon offering the Secret Service API.")
 
@@ -665,6 +675,145 @@
 	:session secrets-service item-path
 	secrets-interface-item "Delete")))))
 
+;;; Visualization.
+
+(define-derived-mode secrets-mode nil "Secrets"
+  "Major mode for presenting search results of a Xesam search.
+In this mode, widgets represent the search results.
+
+\\{secrets-mode-map}
+Turning on Xesam mode runs the normal hook `xesam-mode-hook'.  It
+can be used to set `xesam-notify-function', which must a search
+engine specific, widget :notify function to visualize xesam:url."
+  ;; Keymap.
+  (setq secrets-mode-map (copy-keymap special-mode-map))
+  (set-keymap-parent secrets-mode-map widget-keymap)
+  (define-key secrets-mode-map "z" 'kill-this-buffer)
+
+  ;; When we toggle, we must set temporary widgets.
+  (set (make-local-variable 'tree-widget-after-toggle-functions)
+       '(secrets-tree-widget-after-toggle-function))
+
+  (when (not (called-interactively-p 'interactive))
+    ;; Initialize buffer.
+    (setq buffer-read-only t)
+    (let ((inhibit-read-only t))
+      (erase-buffer))))
+
+;; It doesn't make sense to call it interactively.
+(put 'secrets-mode 'disabled t)
+
+;; The very first buffer created with `secrets-mode' does not have the
+;; keymap etc.  So we create a dummy buffer.  Stupid.
+(with-temp-buffer (secrets-mode))
+
+;;;###autoload
+(defun secrets-show-secrets ()
+  "Display a list of collections from the Secret Service API.
+The collections are in tree view, that means they can be expanded
+to the corresponding secret items, which could also be expanded
+to their attributes."
+  (interactive)
+  ;; Create the search buffer.
+  (with-current-buffer (get-buffer-create "*Secrets*")
+    (switch-to-buffer-other-window (current-buffer))
+    ;; Inialize buffer with `secrets-mode'.
+    (secrets-mode)
+    (secrets-show-collections)))
+
+(defun secrets-show-collections ()
+  "Show all available collections."
+  (let ((inhibit-read-only t)
+	(alias (secrets-get-alias "default")))
+    (erase-buffer)
+    (tree-widget-set-theme "folder")
+    (dolist (coll (secrets-list-collections))
+      (widget-create
+     `(tree-widget
+       :tag ,coll
+       :collection ,coll
+       :open nil
+       :sample-face bold
+       :expander secrets-expand-collection)))))
+
+(defun secrets-expand-collection (widget)
+  "Expand items of collection shown as WIDGET."
+  (let ((coll (widget-get widget :collection)))
+    (mapcar
+     (lambda (item)
+       `(tree-widget
+	 :tag ,item
+	 :collection ,coll
+	 :item ,item
+	 :open nil
+	 :sample-face bold
+	 :expander secrets-expand-item))
+     (secrets-list-items coll))))
+
+(defun secrets-expand-item (widget)
+  "Expand password and attributes of item shown as WIDGET."
+  (let* ((coll (widget-get widget :collection))
+	 (item (widget-get widget :item))
+	 (attributes (secrets-get-attributes coll item))
+	 ;; padding is needed to format attribute names.
+	 (padding
+	  (1+
+	   (apply
+	    'max
+	    (cons
+	     (length "password")
+	     (mapcar
+	      (lambda (attribute) (length (symbol-name (car attribute))))
+	      attributes))))))
+    (cons
+     ;; The password widget.
+     `(editable-field :tag "password"
+		      :secret ?*
+		      :value ,(secrets-get-secret coll item)
+		      :sample-face widget-button-pressed
+		      ;; We specify :size in order to limit the field.
+		      :size 0
+		      :format ,(concat
+				"%{%t%}:"
+				(make-string (- padding (length "password")) ? )
+				"%v\n"))
+     (mapcar
+      (lambda (attribute)
+	(let ((name (symbol-name (car attribute)))
+	      (value (cdr attribute)))
+	  ;; The attribute widget.
+	  `(editable-field :tag ,name
+			   :value ,value
+			   :sample-face widget-documentation
+			   ;; We specify :size in order to limit the field.
+			   :size 0
+			   :format ,(concat
+				     "%{%t%}:"
+				     (make-string (- padding (length name)) ? )
+				     "%v\n"))))
+      attributes))))
+
+(defun secrets-tree-widget-after-toggle-function (widget &rest ignore)
+  "Add a temporary widget to show the password."
+  (dolist (child (widget-get widget :children))
+    (when (widget-member child :secret)
+      (goto-char (widget-field-end child))
+      (widget-insert " ")
+      (widget-create-child-and-convert
+       child 'push-button
+       :notify 'secrets-tree-widget-show-password
+       "Show password")))
+  (widget-setup))
+
+(defun secrets-tree-widget-show-password (widget &rest ignore)
+  "Show password, and remove temporary widget."
+  (let ((parent (widget-get widget :parent)))
+    (widget-put parent :secret nil)
+    (widget-default-value-set parent (widget-get parent :value))
+    (widget-setup)))
+
+;;; Initialization.
+
 (when (dbus-ping :session secrets-service 100)
 
   ;; We must reset all variables, when there is a new instance of the
--- a/lisp/progmodes/prolog.el	Mon May 17 22:44:26 2010 +0000
+++ b/lisp/progmodes/prolog.el	Tue May 18 22:45:34 2010 +0000
@@ -31,6 +31,7 @@
 
 (defvar comint-prompt-regexp)
 (defvar comint-process-echoes)
+(defvar smie-indent-basic)
 
 (defgroup prolog nil
   "Major mode for editing and running Prolog under Emacs."
@@ -179,7 +180,7 @@
     (define-key map "\C-c\C-l" 'inferior-prolog-load-file)
     (define-key map "\C-c\C-z" 'switch-to-prolog)
     map))
- 
+
 (easy-menu-define prolog-mode-menu prolog-mode-map "Menu for Prolog mode."
   ;; Mostly copied from scheme-mode's menu.
   ;; Not tremendously useful, but it's a start.
--- a/lisp/subr.el	Mon May 17 22:44:26 2010 +0000
+++ b/lisp/subr.el	Tue May 18 22:45:34 2010 +0000
@@ -1868,16 +1868,14 @@
 	(if inhibit-quit (setq quit-flag nil)))
       ;; Translate TAB key into control-I ASCII character, and so on.
       ;; Note: `read-char' does it using the `ascii-character' property.
-      ;; We could try and use read-key-sequence instead, but then C-q ESC
-      ;; or C-q C-x might not return immediately since ESC or C-x might be
-      ;; bound to some prefix in function-key-map or key-translation-map.
+      ;; We should try and use read-key instead.
+      (let ((translation (lookup-key local-function-key-map (vector char))))
+	(if (arrayp translation)
+	    (setq translated (aref translation 0))))
       (setq translated
 	    (if (integerp char)
 		(char-resolve-modifiers char)
 	      char))
-      (let ((translation (lookup-key local-function-key-map (vector char))))
-	(if (arrayp translation)
-	    (setq translated (aref translation 0))))
       (cond ((null translated))
 	    ((not (integerp translated))
 	     (setq unread-command-events (list char)
--- a/msdos/ChangeLog	Mon May 17 22:44:26 2010 +0000
+++ b/msdos/ChangeLog	Tue May 18 22:45:34 2010 +0000
@@ -1,3 +1,14 @@
+2010-05-18  Eli Zaretskii  <eliz@gnu.org>
+
+	* sed1x.inp: Add copyright notice.
+
+2010-05-18  Glenn Morris  <rgm@gnu.org>
+
+	* sed1v2.inp (RALLOC_OBJ): Edit to ralloc.o.
+
+	* sed1v2.inp (GMALLOC_OBJ): Edit to gmalloc.o.
+	(VMLIMIT_OBJ): Edit to vm-limit.o.
+
 2010-05-17  Glenn Morris  <rgm@gnu.org>
 
 	* sed1v2.inp (OLDXMENU_DEPS): Edit to empty.
--- a/msdos/sed1v2.inp	Mon May 17 22:44:26 2010 +0000
+++ b/msdos/sed1v2.inp	Tue May 18 22:45:34 2010 +0000
@@ -116,6 +116,9 @@
 /^OLDXMENU *=/s/@OLDXMENU@//
 /^LIBXMENU *=/s/@LIBXMENU@//
 /^LIBX_OTHER *=/s/@LIBX_OTHER@//
+/^GMALLOC_OBJ *=/s/@GMALLOC_OBJ@/gmalloc.o/
+/^VMLIMIT_OBJ *=/s/@VMLIMIT_OBJ@/vm-limit.o/
+/^RALLOC_OBJ *=/s/@RALLOC_OBJ@/ralloc.o/
 /^PRE_ALLOC_OBJ *=/s/@PRE_ALLOC_OBJ@/lastfile.o/
 /^POST_ALLOC_OBJ *=/s/@POST_ALLOC_OBJ@/$(vmlimitobj)/
 /^UNEXEC_OBJ *=/s/@unexec@/unexec.o/
--- a/msdos/sed1x.inp	Mon May 17 22:44:26 2010 +0000
+++ b/msdos/sed1x.inp	Tue May 18 22:45:34 2010 +0000
@@ -1,6 +1,21 @@
 # -sed1x.inp------------------------------------------------------------
 # Extra configuration script for src/makefile for DesqView/X
 # ----------------------------------------------------------------------
+#
+# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
+#   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+#
+# This file is part of GNU Emacs.
+#
+# This file is free software; as a special exception, the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# 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.
+#
+# ----------------------------------------------------------------------
 s!^	cd \${oldXMenudir}; \${MAKE}.*$!	${MAKE} -C ${oldXMenudir}.!
 s!^	@true *$!	@rem!
 s/DOC/DOC-X/g
--- a/src/ChangeLog	Mon May 17 22:44:26 2010 +0000
+++ b/src/ChangeLog	Tue May 18 22:45:34 2010 +0000
@@ -1,3 +1,31 @@
+2010-05-18  Chong Yidong  <cyd@stupidchicken.com>
+
+	* character.c (Fstring, Funibyte_string): Use SAFE_ALLOCA to
+	prevent stack overflow if number of arguments is too large
+	(Bug#6214).
+
+2010-05-18  Juanma Barranquero  <lekktu@gmail.com>
+
+	* charset.c (load_charset_map_from_file): Don't call close after fclose.
+
+2010-05-18  Glenn Morris  <rgm@gnu.org>
+
+	* s/gnu-linux.h: Combine two conditionals.
+
+	* Makefile.in (otherobj): Include $(VMLIMIT_OBJ) separately from
+	$(POST_ALLOC_OBJ).
+
+	* Makefile.in (RALLOC_OBJ): New, set by configure.
+	(rallocobj): Replace with the previous variable.
+	(otherobj): Use $RALLOC_OBJ.
+
+	* s/gnu.h (REL_ALLOC) [DOUG_LEA_MALLOC]:
+	* s/gnu-linux.h (REL_ALLOC) [DOUG_LEA_MALLOC]: Move undef to configure.
+
+	* Makefile.in (GMALLOC_OBJ, VMLIMIT_OBJ): New, set by configure.
+	(gmallocobj, vmlimitobj): Replace with previous two variables.
+	(otherobj): Use $GMALLOC_OBJ, $VMLIMIT_OBJ.
+
 2010-05-17  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (OLDXMENU_DEPS): New, set by configure.
@@ -45,8 +73,7 @@
 
 2010-05-15  Ken Raeburn  <raeburn@raeburn.org>
 
-	* lisp.h (XFLOAT_DATA): Use "0?x:x" to generate an
-	rvalue. (bug#5916)
+	* lisp.h (XFLOAT_DATA): Use "0?x:x" to generate an rvalue.  (Bug#5916)
 	(LISP_MAKE_RVALUE) [!USE_LISP_UNION_TYPE && !__GNUC__]: Likewise.
 
 	* emacs.c (main): Initialize initial-environment and
@@ -120,8 +147,7 @@
 
 2010-05-14  Kenichi Handa  <handa@m17n.org>
 
-	* font.c (font_range): Return the range for the font found at
-	first.
+	* font.c (font_range): Return the range for the font found at first.
 
 2010-05-14  Glenn Morris  <rgm@gnu.org>
 
@@ -11580,7 +11606,7 @@
 	definitions from xmenu.c.  Suggested by Adrian Robert.
 
 	* xmenu.c: Remove platform-independent menu definitions.
-	(menu_items menu_items_inuse, menu_items_allocated)
+	(menu_items, menu_items_inuse, menu_items_allocated)
 	(menu_items_used, menu_items_n_panes)
 	(menu_items_submenu_depth): Move to keyboard.h.
 	(init_menu_items, finish_menu_items, unuse_menu_items)
--- a/src/Makefile.in	Mon May 17 22:44:26 2010 +0000
+++ b/src/Makefile.in	Tue May 18 22:45:34 2010 +0000
@@ -401,29 +401,23 @@
   w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
   w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_OBJ)
 
-gmallocobj =
-rallocobj =
-vmlimitobj =
-#ifndef SYSTEM_MALLOC
-#ifndef DOUG_LEA_MALLOC
-gmallocobj = gmalloc.o
-#endif
+/* gmalloc.o if !SYSTEM_MALLOC && !DOUG_LEA_MALLOC, else empty.  */
+GMALLOC_OBJ=@GMALLOC_OBJ@
 
-#ifdef REL_ALLOC
-rallocobj = ralloc.o
-#endif
+/* vm-limit.o if !SYSTEM_MALLOC, else empty.  */
+VMLIMIT_OBJ=@VMLIMIT_OBJ@
 
-vmlimitobj = vm-limit.o
-#endif /* !SYSTEM_MALLOC */
+/* ralloc.o if !SYSTEM_MALLOC && REL_ALLOC, else empty.  */
+RALLOC_OBJ=@RALLOC_OBJ@
 
 /* Empty on Cygwin, lastfile.o elsewhere.  */
 PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@
-/* lastfile.o vm-limit.o on Cygwin, $vmlimitobj elsewhere.  */
+/* lastfile.o on Cygwin, empty elsewhere.  */
 POST_ALLOC_OBJ=@POST_ALLOC_OBJ@
 
 /* List of object files that make-docfile should not be told about.  */
-otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(gmallocobj) $(rallocobj) \
-  $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
+otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
+  $(POST_ALLOC_OBJ) $(VMLIMIT_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
 
 /* This is the platform-specific list of Lisp files loaded into the
    dumped Emacs.  It is arranged like this because it is easier to generate
--- a/src/character.c	Mon May 17 22:44:26 2010 +0000
+++ b/src/character.c	Tue May 18 22:45:34 2010 +0000
@@ -961,10 +961,13 @@
      int n;
      Lisp_Object *args;
 {
-  int i;
-  unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n);
-  unsigned char *p = buf;
-  int c;
+  int i, c;
+  unsigned char *buf, *p;
+  Lisp_Object str;
+  USE_SAFE_ALLOCA;
+
+  SAFE_ALLOCA (buf, unsigned char *, MAX_MULTIBYTE_LENGTH * n);
+  p = buf;
 
   for (i = 0; i < n; i++)
     {
@@ -973,7 +976,9 @@
       p += CHAR_STRING (c, p);
     }
 
-  return make_string_from_bytes ((char *) buf, n, p - buf);
+  str = make_string_from_bytes ((char *) buf, n, p - buf);
+  SAFE_FREE ();
+  return str;
 }
 
 DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0,
@@ -983,10 +988,13 @@
      int n;
      Lisp_Object *args;
 {
-  int i;
-  unsigned char *buf = (unsigned char *) alloca (n);
-  unsigned char *p = buf;
-  unsigned c;
+  int i, c;
+  unsigned char *buf, *p;
+  Lisp_Object str;
+  USE_SAFE_ALLOCA;
+
+  SAFE_ALLOCA (buf, unsigned char *, n);
+  p = buf;
 
   for (i = 0; i < n; i++)
     {
@@ -997,7 +1005,9 @@
       *p++ = c;
     }
 
-  return make_string_from_bytes ((char *) buf, n, p - buf);
+  str = make_string_from_bytes ((char *) buf, n, p - buf);
+  SAFE_FREE ();
+  return str;
 }
 
 DEFUN ("char-resolve-modifiers", Fchar_resolve_modifiers,
--- a/src/charset.c	Mon May 17 22:44:26 2010 +0000
+++ b/src/charset.c	Tue May 18 22:45:34 2010 +0000
@@ -567,7 +567,6 @@
       n_entries++;
     }
   fclose (fp);
-  close (fd);
 
   load_charset_map (charset, head, n_entries, control_flag);
   SAFE_FREE ();
--- a/src/m/template.h	Mon May 17 22:44:26 2010 +0000
+++ b/src/m/template.h	Tue May 18 22:45:34 2010 +0000
@@ -69,11 +69,14 @@
    reasonable place to select for it is in the machine description file.  */
 #define NO_SOCK_SIGIO
 
-/* After adding support for a new system, modify the large case
-   statement in the `configure' script to recognize reasonable
+/* After adding support for a new machine, modify the large case
+   statement in configure.in to recognize reasonable
    configuration names, and add a description of the system to
    `etc/MACHINES'.
 
+   Check for any tests of $machine in configure.in, and add an entry
+   for the new machine if needed.
+
    If you've just fixed a problem in an existing configuration file,
    you should also check `etc/MACHINES' to make sure its descriptions
    of known problems in that configuration should be updated.  */
--- a/src/s/gnu-linux.h	Mon May 17 22:44:26 2010 +0000
+++ b/src/s/gnu-linux.h	Tue May 18 22:45:34 2010 +0000
@@ -97,7 +97,6 @@
 /* This is used in list_system_processes.  */
 #define HAVE_PROCFS 1
 
-
 /* Define CLASH_DETECTION if you want lock files to be written
    so that Emacs can tell instantly when you try to modify
    a file that someone else has modified in his Emacs.  */
@@ -126,12 +125,10 @@
 #define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
   ((FILE)->_pptr - (FILE)->_pbase)
 #endif /* !_IO_STDIO_H && ! __UCLIBC__ */
+
+#define INTERRUPT_INPUT
 #endif /* emacs */
 
-#ifdef emacs
-#define INTERRUPT_INPUT
-#endif
-
 #define SYSV_SYSTEM_DIR       /* use dirent.h */
 
 #define POSIX                 /* affects getpagesize.h and systty.h */
@@ -147,11 +144,6 @@
 
 #define NARROWPROTO 1
 
-/* Use mmap directly for allocating larger buffers.  */
-#ifdef DOUG_LEA_MALLOC
-#undef REL_ALLOC
-#endif
-
 /* Tell that garbage collector that setjmp is known to save all
    registers relevant for conservative garbage collection in the jmp_buf.  */
 /* Not all the architectures are tested, but there are Debian packages
--- a/src/s/gnu.h	Mon May 17 22:44:26 2010 +0000
+++ b/src/s/gnu.h	Tue May 18 22:45:34 2010 +0000
@@ -1,6 +1,7 @@
 /* Definitions file for GNU Emacs running on the GNU Hurd.
-   Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -28,11 +29,6 @@
 
 #define SIGNALS_VIA_CHARACTERS
 
-/* Use mmap directly for allocating larger buffers.  */
-#ifdef DOUG_LEA_MALLOC
-#undef REL_ALLOC
-#endif
-
 /* GNU needs its own crt0, and libc defines data_start.  */
 #define ORDINARY_LINK
 #define DATA_START ({ extern int data_start; (char *) &data_start; })
--- a/src/s/template.h	Mon May 17 22:44:26 2010 +0000
+++ b/src/s/template.h	Tue May 18 22:45:34 2010 +0000
@@ -133,10 +133,13 @@
 /* ============================================================ */
 
 /* After adding support for a new system, modify the large case
-   statement in the `configure' script to recognize reasonable
+   statement in configure.in to recognize reasonable
    configuration names, and add a description of the system to
    `etc/MACHINES'.
 
+   Check for any tests of $opsys in configure.in, and add an entry
+   for the new system if needed.
+
    If you've just fixed a problem in an existing configuration file,
    you should also check `etc/MACHINES' to make sure its descriptions
    of known problems in that configuration should be updated.  */