changeset 108051:741b32aae521

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 18 Apr 2010 22:46:37 +0000
parents 7e67a31551fc (current diff) 265966b778f9 (diff)
children ac3787d5aa1f
files
diffstat 27 files changed, 559 insertions(+), 244 deletions(-) [+]
line wrap: on
line diff
--- a/doc/emacs/ChangeLog	Fri Apr 16 03:24:45 2010 +0000
+++ b/doc/emacs/ChangeLog	Sun Apr 18 22:46:37 2010 +0000
@@ -1,3 +1,7 @@
+2010-04-16  Glenn Morris  <rgm@gnu.org>
+
+	* ack.texi, emacs.texi (Acknowledgments): Update for Org changes.
+
 2010-04-11  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xresources.texi (Lucid Resources): Mention faceName for dialogs.
--- a/doc/emacs/ack.texi	Fri Apr 16 03:24:45 2010 +0000
+++ b/doc/emacs/ack.texi	Sun Apr 18 22:46:37 2010 +0000
@@ -252,11 +252,11 @@
 Carsten Dominik wrote Ref@TeX{}, a package for setting up labels and
 cross-references in La@TeX{} documents; and co-wrote IDLWAVE mode
 (q.v.@:).  He was the main author of Org mode, for maintaining notes,
-todo lists, and project planning.  Thomas Baumann, Lennart Borgman,
-Baoqiu Cui, Daniel German, Bastien Guerry, Tassilo Horn, Philip Jackson,
-Tokuya Kameshima, Ross Patterson, Sebastian Rose, Eric Schulte, Andy
-Stewart, David O'Toole, John Wiegley, and Piotr Zielinski also wrote
-various Org mode components.
+todo lists, and project planning.  Thomas Baumann, Jan Böcker, Lennart
+Borgman, Baoqiu Cui, Daniel German, Bastien Guerry, Tassilo Horn, Philip
+Jackson, Tokuya Kameshima, Ross Patterson, Sebastian Rose, Eric Schulte,
+Paul Sexton, Ulf Stegemann, Andy Stewart, David O'Toole, John Wiegley,
+and Piotr Zielinski also wrote various Org mode components.
 
 @item
 Scott Draves wrote @file{tq.el}, help functions for maintaining
--- a/doc/emacs/emacs.texi	Fri Apr 16 03:24:45 2010 +0000
+++ b/doc/emacs/emacs.texi	Sun Apr 18 22:46:37 2010 +0000
@@ -1346,13 +1346,13 @@
 Joe Arceneaux, Miles Bader, David Bakhash, Juanma Barranquero, Eli
 Barzilay, Thomas Baumann, Steven L.@: Baur, Jay Belanger, Alexander L.@:
 Belikoff, Boaz Ben-Zvi, Karl Berry, Anna M.@: Bigatti, Ray Blaak, Jim
-Blandy, Johan Bockg@aa{}rd, Lennart Borgman, Per Bothner, Terrence
-Brannon, Frank Bresz, Peter Breton, Emmanuel Briot, Kevin Broadey,
-Vincent Broman, David M.@: Brown, Georges Brun-Cottan, Joe Buehler,
-W@l{}odek Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky, Chong
-Yidong, Chris Chase, Bob Chassell, Andrew Choi, Sacha Chua, James Clark,
-Mike Clarkson, Glynn Clements, Daniel Colascione, Andrew Csillag, Baoqiu
-Cui, Doug Cutting, Mathias Dahl, Satyaki Das, Vivek Dasmohapatra,
+Blandy, Johan Bockg@aa{}rd, Jan Böcker, Lennart Borgman, Per Bothner,
+Terrence Brannon, Frank Bresz, Peter Breton, Emmanuel Briot, Kevin
+Broadey, Vincent Broman, David M.@: Brown, Georges Brun-Cottan, Joe
+Buehler, W@l{}odek Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky,
+Chong Yidong, Chris Chase, Bob Chassell, Andrew Choi, Sacha Chua, James
+Clark, Mike Clarkson, Glynn Clements, Daniel Colascione, Andrew Csillag,
+Baoqiu Cui, Doug Cutting, Mathias Dahl, Satyaki Das, Vivek Dasmohapatra,
 Michael DeCorte, Gary Delp, Matthieu Devin, Eri Ding, Jan Dj@"{a}rv,
 Carsten Dominik, Scott Draves, Benjamin Drieu, Viktor Dukhovni, Dmitry
 Dzhus, John Eaton, Rolf Ebert, Paul Eggert, Stephen Eglen, Torbj@"orn
@@ -1375,16 +1375,16 @@
 Henry Kautz, Taichi Kawabata, Howard Kaye, Michael Kifer, Richard King,
 Peter Kleiweg, Shuhei Kobayashi, Pavel Kobiakov, Larry K.@: Kolodney,
 David M.@: Koppelman, Koseki Yoshinori, Robert Krawitz, Sebastian
-Kremer, Ryszard Kubiak, David K@aa{}gedal, Daniel LaLiberte,
-Karl Landstrom, Mario Lang, Aaron Larson, James R.@: Larus,
-Vinicius Jose Latorre, Werner Lemberg, Frederic Lepied, Peter
-Liljenberg, Lars Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link,
-Juri Linkov, Francis Litterio, Emilio C. Lopes, K@'{a}roly L@H{o}rentey,
-Dave Love, Sascha L@"{u}decke, Eric Ludlam, Alan Mackenzie, Christopher
-J.@: Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann, Brian Marick,
-Simon Marshall, Bengt Martensson, Charlie Martin, Thomas May, Roland
-McGrath, Will Mengarini, David Megginson, Ben A. Mesander, Wayne Mesard,
-Brad Miller, Lawrence Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan
+Kremer, Ryszard Kubiak, David K@aa{}gedal, Daniel LaLiberte, Karl
+Landstrom, Mario Lang, Aaron Larson, James R.@: Larus, Vinicius Jose
+Latorre, Werner Lemberg, Frederic Lepied, Peter Liljenberg, Lars
+Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, Juri Linkov,
+Francis Litterio, Emilio C. Lopes, K@'{a}roly L@H{o}rentey, Dave Love,
+Sascha L@"{u}decke, Eric Ludlam, Alan Mackenzie, Christopher J.@:
+Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann, Brian Marick, Simon
+Marshall, Bengt Martensson, Charlie Martin, Thomas May, Roland McGrath,
+Will Mengarini, David Megginson, Ben A. Mesander, Wayne Mesard, Brad
+Miller, Lawrence Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan
 Monnier, Morioka Tomohiko, Keith Moore, Jan Moringen, Glenn Morris,
 Diane Murray, Sen Nagata, Erik Naggum, Thomas Neumann, Thien-Thi Nguyen,
 Mike Newton, Jurgen Nickelsen, Dan Nicolaescu, Hrvoje Niksic, Jeff
@@ -1403,22 +1403,22 @@
 Schleicher, Gregor Schmid, Michael Schmidt, Ronald S. Schnell, Philippe
 Schnoebelen, Jan Schormann, Alex Schroeder, Stephen Schoef, Raymond
 Scholz, Eric Schulte, Andreas Schwab, Randal Schwartz, Oliver Seidel,
-Manuel Serrano, Hovav Shacham, Stanislav Shalunov, Marc Shapiro, Richard
-Sharman, Olin Shivers, Espen Skoglund, Rick Sladkey, Lynn Slater, Chris
-Smith, David Smith, Paul D.@: Smith, Andre Spiegel, Michael Staats,
-William Sommerfeld, Michael Staats, Reiner Steib, Sam Steingold, Ake
-Stenhoff, Peter Stephenson, Ken Stevens, Andy Stewart, Jonathan
-Stigelman, Martin Stjernholm, Kim F.@: Storm, Steve Strassman, Olaf
-Sylvester, Naoto Takahashi, Steven Tamm, Jean-Philippe Theberge, Jens
-T.@: Berger Thielemann, Spencer Thomas, Jim Thompson, Luc Teirlinck,
-David O'Toole, Tom Tromey, Enami Tsugutomo, Eli Tziperman, Daiki Ueno,
-Masanobu Umeda, Rajesh Vaidheeswarran, Neil W.@: Van Dyke, Didier Verna,
-Joakim Verona, Ulrik Vieth, Geoffrey Voelker, Johan Vromans, Inge
-Wallin, John Paul Wallington, Colin Walters, Barry Warsaw, Morten
-Welinder, Joseph Brian Wells, Rodney Whitby, John Wiegley, Ed Wilkinson,
-Mike Williams, Bill Wohler, Steven A. Wood, Dale R.@: Worley, Francis
-J.@: Wright, Felix S. T. Wu, Tom Wurgler, Katsumi Yamaoka, Yamamoto
-Mitsuharu, Masatake Yamato, Jonathan Yavner, Ryan Yeske, Ilya
+Manuel Serrano, Paul Sexton, Hovav Shacham, Stanislav Shalunov, Marc
+Shapiro, Richard Sharman, Olin Shivers, Espen Skoglund, Rick Sladkey,
+Lynn Slater, Chris Smith, David Smith, Paul D.@: Smith, William
+Sommerfeld, Andre Spiegel, Michael Staats, Ulf Stegemann, Reiner Steib,
+Sam Steingold, Ake Stenhoff, Peter Stephenson, Ken Stevens, Andy Stewart,
+Jonathan Stigelman, Martin Stjernholm, Kim F.@: Storm, Steve Strassman,
+Olaf Sylvester, Naoto Takahashi, Steven Tamm, Jean-Philippe Theberge,
+Jens T.@: Berger Thielemann, Spencer Thomas, Jim Thompson, Luc
+Teirlinck, David O'Toole, Tom Tromey, Enami Tsugutomo, Eli Tziperman,
+Daiki Ueno, Masanobu Umeda, Rajesh Vaidheeswarran, Neil W.@: Van Dyke,
+Didier Verna, Joakim Verona, Ulrik Vieth, Geoffrey Voelker, Johan
+Vromans, Inge Wallin, John Paul Wallington, Colin Walters, Barry Warsaw,
+Morten Welinder, Joseph Brian Wells, Rodney Whitby, John Wiegley, Ed
+Wilkinson, Mike Williams, Bill Wohler, Steven A. Wood, Dale R.@: Worley,
+Francis J.@: Wright, Felix S. T. Wu, Tom Wurgler, Katsumi Yamaoka,
+Yamamoto Mitsuharu, Masatake Yamato, Jonathan Yavner, Ryan Yeske, Ilya
 Zakharevich, Milan Zamazal, Victor Zandy, Eli Zaretskii, Jamie Zawinski,
 Shenghuo Zhu, Piotr Zielinski, Ian T.@: Zimmermann, Reto Zimmermann,
 Neal Ziring, Teodor Zlatanov, and Detlev Zundel.
--- a/doc/misc/ChangeLog	Fri Apr 16 03:24:45 2010 +0000
+++ b/doc/misc/ChangeLog	Sun Apr 18 22:46:37 2010 +0000
@@ -1,3 +1,9 @@
+2010-04-18  Jay Belanger  <jay.p.belanger@gmail.com>
+
+	* calc.texi (Radix modes): Mention that the option prefix will
+	turn on twos-complement mode.
+	(Inverse and Hyperbolic Flags): Mention the Option flag.
+
 2010-04-15  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi (LaTeX and PDF export): Add a footnote about xetex.
--- a/doc/misc/calc.texi	Fri Apr 16 03:24:45 2010 +0000
+++ b/doc/misc/calc.texi	Sun Apr 18 22:46:37 2010 +0000
@@ -12289,15 +12289,21 @@
 toggle the Inverse and/or Hyperbolic flags and then execute the
 corresponding base command (@code{calc-sin} in this case).
 
-The Inverse and Hyperbolic flags apply only to the next Calculator
-command, after which they are automatically cleared.  (They are also
-cleared if the next keystroke is not a Calc command.)  Digits you
-type after @kbd{I} or @kbd{H} (or @kbd{K}) are treated as prefix
-arguments for the next command, not as numeric entries.  The same
-is true of @kbd{C-u}, but not of the minus sign (@kbd{K -} means to
-subtract and keep arguments).
-
-The third Calc prefix flag, @kbd{K} (keep-arguments), is discussed
+@kindex O
+@pindex calc-option
+The @kbd{O} key (@code{calc-option}) sets another flag, the
+@dfn{Option Flag}, which also can alter the subsequent Calc command in
+various ways. 
+
+The Inverse, Hyperbolic and Option flags apply only to the next
+Calculator command, after which they are automatically cleared.  (They
+are also cleared if the next keystroke is not a Calc command.)  Digits
+you type after @kbd{I}, @kbd{H} or @kbd{O} (or @kbd{K}) are treated as
+prefix arguments for the next command, not as numeric entries.  The
+same is true of @kbd{C-u}, but not of the minus sign (@kbd{K -} means
+to subtract and keep arguments).
+
+Another Calc prefix flag, @kbd{K} (keep-arguments), is discussed
 elsewhere.  @xref{Keep Arguments}.
 
 @node Calculation Modes, Simplification Modes, Inverse and Hyperbolic, Mode Settings
@@ -13175,12 +13181,13 @@
 entirety.) 
 
 @cindex Two's complements
-With the binary, octal and hexadecimal display modes, Calc can
-display @expr{w}-bit integers using two's complement notation.  This
-option is selected with the key sequences @kbd{C-u d 2}, @kbd{C-u d 8}
-and @kbd{C-u d 6}, respectively, and a negative word size might be
-appropriate (@pxref{Binary Functions}). In two's complement 
-notation, the integers in the (nearly) symmetric interval from
+Calc can display @expr{w}-bit integers using two's complement
+notation, although this is most useful with the binary, octal and
+hexadecimal display modes.  This option is selected by using the
+@kbd{O} option prefix before setting the display radix, and a negative word
+size might be appropriate (@pxref{Binary Functions}). In two's
+complement notation, the integers in the (nearly) symmetric interval
+from
 @texline @math{-2^{w-1}}
 @infoline @expr{-2^(w-1)}
 to
@@ -35461,6 +35468,7 @@
 @r{       @:      M     @:             @:        @:calc-more-recursion-depth@:}
 @r{       @:    I M     @:             @:        @:calc-less-recursion-depth@:}
 @r{      a@:      N     @:             @:     5  @:evalvn@:(a)}
+@r{       @:      O     @:command      @:    32  @:@:Option}
 @r{       @:      P     @:             @:        @:@:pi}
 @r{       @:    I P     @:             @:        @:@:gamma}
 @r{       @:    H P     @:             @:        @:@:e}
--- a/etc/ChangeLog	Fri Apr 16 03:24:45 2010 +0000
+++ b/etc/ChangeLog	Sun Apr 18 22:46:37 2010 +0000
@@ -1,3 +1,7 @@
+2010-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* HELLO (Mathematics): Prefer Unicode charset.
+
 2010-03-30  Chong Yidong  <cyd@stupidchicken.com>
 
 	* images/icons/hicolor/scalable/apps/emacs.svg: Put preamble after
--- a/etc/HELLO	Fri Apr 16 03:24:45 2010 +0000
+++ b/etc/HELLO	Sun Apr 18 22:46:37 2010 +0000
@@ -44,7 +44,7 @@
 Lao ((1>RJRERG(B)	(1JP:R-4U(B / (1"mcKib*!4U(B
 Malayalam ($,1@N@R@O@^@S@"(B)	$,1@H@N@X@m@5@^@P@"(B
 Maltese (il-Malti)	Bon,Cu(Bu / Sa,C11(Ba
-Mathematics	$B"O(B p $A!J(B world $(O#@(B hello p  $A!u(B
+Mathematics	$,1x (B p $,1x((B world $,1s"(B hello p  $,2!a(B
 Nederlands, Vlaams	Hallo / Dag
 Norwegian (norsk)	Hei / God dag
 Oriya ($,1:s;\;?:f(B)	$,1;6;A;#;?;,;G(B
--- a/lisp/ChangeLog	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/ChangeLog	Sun Apr 18 22:46:37 2010 +0000
@@ -1,3 +1,43 @@
+2010-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* loadup.el: Setup hash-cons for pure data.
+
+	Fix duplicate entries in cedet's loaddefs.el files.
+	* emacs-lisp/autoload.el (autoload-file-load-name): Be more clever.
+	Should make most file-local generated-autoload-file unnecessary.
+	(print-readably): Silence warnings.
+	(autoload-find-destination): Take load-name as an arg to make sure
+	it's the same as the one that will be in the file.
+	(autoload-generate-file-autoloads): Adjust to above changes.
+	Try to make the dataflow a bit simpler.
+
+	* cvs-status.el (cvs-refontify): Remove unused.
+
+2010-04-18  Jay Belanger  <jay.p.belanger@gmail.com>
+
+	* calc.el (calc-mode-map): Bind "O" to `calc-missing-key'.
+
+	* calc-bin.el (calc-radix): Have the "O" option turn on
+	twos-complement mode.
+
+2010-04-17  Jay Belanger  <jay.p.belanger@gmail.com>
+
+	* calc-ext.el (calc-init-extensions): Add keybinding for 'calc-option'.
+	Add `calc-option-prefix-help' to calc-help autoloads.
+	(calc-inverse): Add "Option" to message, as appropriate.
+	(calc-hyperbolic): Add "Option" to message, as appropriate.
+	(calc-option, calc-is-option): New functions.
+
+	* calc-help.el (calc-full-help):  Add `calc-option-help'.
+	(calc-option-prefix-help): New function.
+
+	* calc-misc.el (calc-help): Add "Option" entry.
+
+	* calc.el (calc-local-var-list): Add `calc-option-flag'.
+	(calc-option-flag): New variable.
+	(calc-do): Set `calc-option-flag to nil.
+	(calc-set-mode-line): Add "Opt " as appropriate.
+
 2010-04-16  Juri Linkov  <juri@jurta.org>
 
 	Move scrolling commands from simple.el to window.el
--- a/lisp/calc/README	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/calc/README	Sun Apr 18 22:46:37 2010 +0000
@@ -72,6 +72,12 @@
 Summary of changes to "Calc"
 ------- -- ------- --  ----
 
+Emacs 24.1
+
+* Added "O" option prefix.
+
+* Used "O" prefix to "d r" (`calc-radix') to turn on twos-complement mode.
+
 Emacs 23.2
 
 * Added twos-complement display.
--- a/lisp/calc/calc-bin.el	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/calc/calc-bin.el	Sun Apr 18 22:46:37 2010 +0000
@@ -175,7 +175,7 @@
        (progn
 	 (calc-change-mode 
           (list 'calc-number-radix 'calc-twos-complement-mode)
-          (list n (and (or (= n 2) (= n 8) (= n 16)) arg)) t)
+          (list n (or arg (calc-is-option))) t)
 	 ;; also change global value so minibuffer sees it
 	 (setq-default calc-number-radix calc-number-radix))
      (setq n calc-number-radix))
--- a/lisp/calc/calc-ext.el	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/calc/calc-ext.el	Sun Apr 18 22:46:37 2010 +0000
@@ -104,6 +104,7 @@
   (define-key calc-mode-map "J" 'calc-conj)
   (define-key calc-mode-map "L" 'calc-ln)
   (define-key calc-mode-map "N" 'calc-eval-num)
+  (define-key calc-mode-map "O" 'calc-option)
   (define-key calc-mode-map "P" 'calc-pi)
   (define-key calc-mode-map "Q" 'calc-sqrt)
   (define-key calc-mode-map "R" 'calc-round)
@@ -1045,7 +1046,7 @@
 calc-d-prefix-help calc-describe-function calc-describe-key
 calc-describe-key-briefly calc-describe-variable calc-f-prefix-help
 calc-full-help calc-g-prefix-help calc-help-prefix
-calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help
+calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help calc-option-prefix-help
 calc-inverse-prefix-help calc-j-prefix-help calc-k-prefix-help
 calc-m-prefix-help calc-r-prefix-help calc-s-prefix-help
 calc-t-prefix-help calc-u-prefix-help calc-v-prefix-help)
@@ -1408,9 +1409,18 @@
                        (with-current-buffer calc-main-buffer
                          calc-hyperbolic-flag)
                      calc-hyperbolic-flag))
-         (msg (if hyp-flag
-                 "Inverse Hyperbolic..."
-               "Inverse...")))
+         (opt-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-option-flag)
+                     calc-option-flag))
+         (msg 
+          (cond
+           ((and opt-flag hyp-flag) "Option Inverse Hyperbolic...")
+           (hyp-flag "Inverse Hyperbolic...")
+           (opt-flag "Option Inverse...")
+           (t "Inverse..."))))
     (calc-fancy-prefix 'calc-inverse-flag msg n)))
 
 (defconst calc-fancy-prefix-map
@@ -1489,9 +1499,18 @@
                        (with-current-buffer calc-main-buffer
                          calc-inverse-flag)
                      calc-inverse-flag))
-         (msg (if inv-flag
-                  "Inverse Hyperbolic..."
-                "Hyperbolic...")))
+         (opt-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-option-flag)
+                     calc-option-flag))
+         (msg 
+          (cond 
+           ((and opt-flag inv-flag) "Option Inverse Hyperbolic...")
+           (opt-flag "Option Hyperbolic...")
+           (inv-flag "Inverse Hyperbolic...")
+           (t "Hyperbolic..."))))
     (calc-fancy-prefix 'calc-hyperbolic-flag msg n)))
 
 (defun calc-hyperbolic-func ()
@@ -1504,6 +1523,31 @@
 (defun calc-is-hyperbolic ()
   calc-hyperbolic-flag)
 
+(defun calc-option (&optional n)
+  (interactive "P")
+  (let* ((inv-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-inverse-flag)
+                     calc-inverse-flag))
+         (hyp-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-hyperbolic-flag)
+                     calc-hyperbolic-flag))
+         (msg 
+          (cond 
+           ((and hyp-flag inv-flag) "Option Inverse Hyperbolic...")
+           (hyp-flag "Option Hyperbolic...")
+           (inv-flag "Option Inverse...")
+           (t "Option..."))))
+    (calc-fancy-prefix 'calc-option-flag msg n)))
+
+(defun calc-is-option ()
+  calc-option-flag)
+
 (defun calc-keep-args (&optional n)
   (interactive "P")
   (calc-fancy-prefix 'calc-keep-args-flag "Keep args..." n))
--- a/lisp/calc/calc-help.el	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/calc/calc-help.el	Sun Apr 18 22:46:37 2010 +0000
@@ -446,6 +446,7 @@
 	    '(calc-inverse-prefix-help
 	      calc-hyperbolic-prefix-help
 	      calc-inv-hyp-prefix-help
+              calc-option-prefix-help
 	      calc-a-prefix-help
 	      calc-b-prefix-help
 	      calc-c-prefix-help
@@ -512,6 +513,11 @@
      "I H + a S (general invert func); v h (rtail)")
    "inverse-hyperbolic" nil))
 
+(defun calc-option-prefix-help ()
+  (interactive)
+  (calc-do-prefix-help
+   '("")
+   "option" nil))
 
 (defun calc-f-prefix-help ()
   (interactive)
--- a/lisp/calc/calc-misc.el	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/calc/calc-misc.el	Sun Apr 18 22:46:37 2010 +0000
@@ -35,6 +35,7 @@
 (declare-function calc-inv-hyp-prefix-help "calc-help" ())
 (declare-function calc-inverse-prefix-help "calc-help" ())
 (declare-function calc-hyperbolic-prefix-help "calc-help" ())
+(declare-function calc-option-prefix-help "calc-help" ())
 (declare-function calc-explain-why "calc-stuff" (why &optional more))
 (declare-function calc-clear-command-flag "calc-ext" (f))
 (declare-function calc-roll-down-with-selections "calc-sel" (n m))
@@ -219,7 +220,7 @@
   (let ((msgs
 	 '("Press `h' for complete help; press `?' repeatedly for a summary"
 	   "Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit"
-	   "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic"
+	   "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic, Option"
 	   "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
 	   "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
 	   "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro"
@@ -245,20 +246,22 @@
 		  (calc-inv-hyp-prefix-help)
 		(calc-inverse-prefix-help))
 	    (calc-hyperbolic-prefix-help))
-	(setq calc-help-phase
-	      (if (eq this-command last-command)
-		  (% (1+ calc-help-phase) (1+ (length msgs)))
-		0))
-	(let ((msg (nth calc-help-phase msgs)))
-	  (message "%s" (if msg
-			    (concat msg ":"
-				    (make-string (- (apply 'max
-							   (mapcar 'length
-								   msgs))
-						    (length msg)) 32)
-				    "  [?=MORE]")
-			  "")))))))
-
+        (if calc-option-flag
+            (calc-option-prefix-help)
+          (setq calc-help-phase
+                (if (eq this-command last-command)
+                    (% (1+ calc-help-phase) (1+ (length msgs)))
+                  0))
+          (let ((msg (nth calc-help-phase msgs)))
+            (message "%s" (if msg
+                              (concat msg ":"
+                                      (make-string (- (apply 'max
+                                                             (mapcar 'length
+                                                                     msgs))
+                                                      (length msg)) 32)
+                                      "  [?=MORE]")
+                            ""))))))))
+  
 
 
 
--- a/lisp/calc/calc.el	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/calc/calc.el	Sun Apr 18 22:46:37 2010 +0000
@@ -797,6 +797,7 @@
 				calc-matrix-mode
 				calc-inverse-flag
 				calc-hyperbolic-flag
+                                calc-option-flag
 				calc-keep-args-flag
 				calc-angle-mode
 				calc-number-radix
@@ -926,6 +927,8 @@
   "If non-nil, next operation is Inverse.")
 (defvar calc-hyperbolic-flag nil
   "If non-nil, next operation is Hyperbolic.")
+(defvar calc-option-flag nil
+  "If non-nil, next operation has Optional behavior.")
 (defvar calc-keep-args-flag nil
   "If non-nil, next operation should not remove its arguments from stack.")
 (defvar calc-function-open "("
@@ -1038,7 +1041,7 @@
     (mapc (lambda (x) (define-key map (char-to-string x) 'undefined))
           "lOW")
     (mapc (lambda (x) (define-key map (char-to-string x) 'calc-missing-key))
-          (concat "ABCDEFGHIJKLMNPQRSTUVXZabcdfghjkmoprstuvwxyz"
+          (concat "ABCDEFGHIJKLMNOPQRSTUVXZabcdfghjkmoprstuvwxyz"
                   ":\\|!()[]<>{},;=~`\C-k\C-w\C-_"))
     (define-key map "\M-w" 'calc-missing-key)
     (define-key map "\M-k" 'calc-missing-key)
@@ -1619,6 +1622,7 @@
 	  (calc-select-buffer)
 	  (setq calc-inverse-flag nil
 		calc-hyperbolic-flag nil
+                calc-option-flag nil
 		calc-keep-args-flag nil)))
       (when (memq 'do-edit calc-command-flags)
 	(switch-to-buffer (get-buffer-create "*Calc Edit*")))
@@ -1757,6 +1761,7 @@
 			      (> (calc-stack-size) 0)
 			      (calc-top 1 'sel)) "Sel " "")
 		     (if calc-display-dirty "Dirty " "")
+                     (if calc-option-flag "Opt " "")
 		     (if calc-inverse-flag "Inv " "")
 		     (if calc-hyperbolic-flag "Hyp " "")
 		     (if calc-keep-args-flag "Keep " "")
--- a/lisp/cvs-status.el	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/cvs-status.el	Sun Apr 18 22:46:37 2010 +0000
@@ -356,11 +356,11 @@
       tags)))
 
 (defvar font-lock-mode)
-(defun cvs-refontify (beg end)
-  (when (and (boundp 'font-lock-mode)
-	     font-lock-mode
-	     (fboundp 'font-lock-fontify-region))
-    (font-lock-fontify-region (1- beg) (1+ end))))
+;; (defun cvs-refontify (beg end)
+;;   (when (and (boundp 'font-lock-mode)
+;; 	     font-lock-mode
+;; 	     (fboundp 'font-lock-fontify-region))
+;;     (font-lock-fontify-region (1- beg) (1+ end))))
 
 (defun cvs-status-trees ()
   "Look for a lists of tags, and replace them with trees."
--- a/lisp/emacs-lisp/autoload.el	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/emacs-lisp/autoload.el	Sun Apr 18 22:46:37 2010 +0000
@@ -328,7 +328,29 @@
   "File local variable to prevent scanning this file for autoload cookies.")
 
 (defun autoload-file-load-name (file)
-  (let ((name (file-name-nondirectory file)))
+  "Compute the name that will be used to load FILE."
+  ;; OUTFILE should be the name of the global loaddefs.el file, which
+  ;; is expected to be at the root directory of the files we're
+  ;; scanning for autoloads and will be in the `load-path'.
+  (let* ((outfile (default-value 'generated-autoload-file))
+         (name (file-relative-name file (file-name-directory outfile)))
+         (names '())
+         (dir (file-name-directory outfile)))
+    ;; If `name' has directory components, only keep the
+    ;; last few that are really needed.
+    (while name
+      (setq name (directory-file-name name))
+      (push (file-name-nondirectory name) names)
+      (setq name (file-name-directory name)))
+    (while (not name)
+      (cond
+       ((null (cdr names)) (setq name (car names)))
+       ((file-exists-p (expand-file-name "subdirs.el" dir))
+        ;; FIXME: here we only check the existence of subdirs.el,
+        ;; without checking its content.  This makes it generate wrong load
+        ;; names for cases like lisp/term which is not added to load-path.
+        (setq dir (expand-file-name (pop names) dir)))
+       (t (setq name (mapconcat 'identity names "/")))))
     (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name)
         (substring name 0 (match-beginning 0))
       name)))
@@ -343,6 +365,8 @@
   (interactive "fGenerate autoloads for file: ")
   (autoload-generate-file-autoloads file (current-buffer)))
 
+(defvar print-readably)
+
 ;; When called from `generate-file-autoloads' we should ignore
 ;; `generated-autoload-file' altogether.  When called from
 ;; `update-file-autoloads' we don't know `outbuf'.  And when called from
@@ -373,9 +397,8 @@
           (visited (get-file-buffer file))
           (otherbuf nil)
           (absfile (expand-file-name file))
-          relfile
           ;; nil until we found a cookie.
-          output-start)
+          output-start ostart)
       (with-current-buffer (or visited
                                ;; It is faster to avoid visiting the file.
                                (autoload-find-file file))
@@ -385,7 +408,10 @@
 	  (setq load-name
 		(if (stringp generated-autoload-load-name)
 		    generated-autoload-load-name
-		  (autoload-file-load-name file)))
+		  (autoload-file-load-name absfile)))
+          (when (and outfile
+                     (not (equal outfile (autoload-generated-file))))
+            (setq otherbuf t))
           (save-excursion
             (save-restriction
               (widen)
@@ -396,26 +422,22 @@
                  ((looking-at (regexp-quote generate-autoload-cookie))
                   ;; If not done yet, figure out where to insert this text.
                   (unless output-start
-                    (when (and outfile
-                               (not (equal outfile (autoload-generated-file))))
-                      ;; A file-local setting of autoload-generated-file says
-                      ;; we should ignore OUTBUF.
-                      (setq outbuf nil)
-                      (setq otherbuf t))
-                    (unless outbuf
-                      (setq outbuf (autoload-find-destination absfile))
-                      (unless outbuf
-                        ;; The file has autoload cookies, but they're
-                        ;; already up-to-date.  If OUTFILE is nil, the
-                        ;; entries are in the expected OUTBUF, otherwise
-                        ;; they're elsewhere.
-                        (throw 'done outfile)))
-                    (with-current-buffer outbuf
-                      (setq relfile (file-relative-name absfile))
-                      (setq output-start (point)))
-                    ;; (message "file=%S, relfile=%S, dest=%S"
-                    ;;          file relfile (autoload-generated-file))
-                    )
+                    (let ((outbuf
+                           (or (if otherbuf
+                                   ;; A file-local setting of
+                                   ;; autoload-generated-file says we
+                                   ;; should ignore OUTBUF.
+                                   nil
+                                 outbuf)
+                               (autoload-find-destination absfile load-name)
+                               ;; The file has autoload cookies, but they're
+                               ;; already up-to-date. If OUTFILE is nil, the
+                               ;; entries are in the expected OUTBUF,
+                               ;; otherwise they're elsewhere.
+                               (throw 'done otherbuf))))
+                      (with-current-buffer outbuf
+                        (setq output-start (point-marker)
+                              ostart (point)))))
                   (search-forward generate-autoload-cookie)
                   (skip-chars-forward " \t")
                   (if (eolp)
@@ -427,7 +449,8 @@
                             (if autoload
                                 (push (nth 1 form) autoloads-done)
                               (setq autoload form))
-                            (let ((autoload-print-form-outbuf outbuf))
+                            (let ((autoload-print-form-outbuf
+                                   (marker-buffer output-start)))
                               (autoload-print-form autoload)))
                         (error
                          (message "Error in %s: %S" file err)))
@@ -442,7 +465,7 @@
                                   (forward-char 1))
                               (point))
                             (progn (forward-line 1) (point)))
-                           outbuf)))
+                           (marker-buffer output-start))))
                  ((looking-at ";")
                   ;; Don't read the comment.
                   (forward-line 1))
@@ -454,40 +477,44 @@
             (let ((secondary-autoloads-file-buf
                    (if (local-variable-p 'generated-autoload-file)
                        (current-buffer))))
-              (with-current-buffer outbuf
+              (with-current-buffer (marker-buffer output-start)
                 (save-excursion
                   ;; Insert the section-header line which lists the file name
                   ;; and which functions are in it, etc.
+                  (assert (= ostart output-start))
                   (goto-char output-start)
-                  (autoload-insert-section-header
-                   outbuf autoloads-done load-name relfile
-                   (if secondary-autoloads-file-buf
-                       ;; MD5 checksums are much better because they do not
-                       ;; change unless the file changes (so they'll be
-                       ;; equal on two different systems and will change
-                       ;; less often than time-stamps, thus leading to fewer
-                       ;; unneeded changes causing spurious conflicts), but
-                       ;; using time-stamps is a very useful optimization,
-                       ;; so we use time-stamps for the main autoloads file
-                       ;; (loaddefs.el) where we have special ways to
-                       ;; circumvent the "random change problem", and MD5
-                       ;; checksum in secondary autoload files where we do
-                       ;; not need the time-stamp optimization because it is
-                       ;; already provided by the primary autoloads file.
-                       (md5 secondary-autoloads-file-buf
-                            ;; We'd really want to just use
-                            ;; `emacs-internal' instead.
-                            nil nil 'emacs-mule-unix)
-                     (nth 5 (file-attributes relfile))))
-                  (insert ";;; Generated autoloads from " relfile "\n"))
+                  (let ((relfile (file-relative-name absfile)))
+                    (autoload-insert-section-header
+                     (marker-buffer output-start)
+                     autoloads-done load-name relfile
+                     (if secondary-autoloads-file-buf
+                         ;; MD5 checksums are much better because they do not
+                         ;; change unless the file changes (so they'll be
+                         ;; equal on two different systems and will change
+                         ;; less often than time-stamps, thus leading to fewer
+                         ;; unneeded changes causing spurious conflicts), but
+                         ;; using time-stamps is a very useful optimization,
+                         ;; so we use time-stamps for the main autoloads file
+                         ;; (loaddefs.el) where we have special ways to
+                         ;; circumvent the "random change problem", and MD5
+                         ;; checksum in secondary autoload files where we do
+                         ;; not need the time-stamp optimization because it is
+                         ;; already provided by the primary autoloads file.
+                         (md5 secondary-autoloads-file-buf
+                              ;; We'd really want to just use
+                              ;; `emacs-internal' instead.
+                              nil nil 'emacs-mule-unix)
+                       (nth 5 (file-attributes relfile))))
+                    (insert ";;; Generated autoloads from " relfile "\n")))
                 (insert generate-autoload-section-trailer))))
           (message "Generating autoloads for %s...done" file))
         (or visited
             ;; We created this buffer, so we should kill it.
             (kill-buffer (current-buffer))))
-      ;; If the entries were added to some other buffer, then the file
-      ;; doesn't add entries to OUTFILE.
-      (or (not output-start) otherbuf))))
+      (or (not output-start)
+          ;; If the entries were added to some other buffer, then the file
+          ;; doesn't add entries to OUTFILE.
+          otherbuf))))
 
 (defun autoload-save-buffers ()
   (while autoload-modified-buffers
@@ -511,15 +538,14 @@
           (message "Autoload section for %s is up to date." file)))
     (if no-autoloads file)))
 
-(defun autoload-find-destination (file)
+(defun autoload-find-destination (file load-name)
   "Find the destination point of the current buffer's autoloads.
 FILE is the file name of the current buffer.
 Returns a buffer whose point is placed at the requested location.
 Returns nil if the file's autoloads are uptodate, otherwise
 removes any prior now out-of-date autoload entries."
   (catch 'up-to-date
-    (let* ((load-name (autoload-file-load-name file))
-           (buf (current-buffer))
+    (let* ((buf (current-buffer))
            (existing-buffer (if buffer-file-name buf))
            (found nil))
       (with-current-buffer
@@ -532,7 +558,7 @@
         (unless (zerop (coding-system-eol-type buffer-file-coding-system))
           (set-buffer-file-coding-system 'unix))
         (or (> (buffer-size) 0)
-            (error "Autoloads file %s does not exist" buffer-file-name))
+            (error "Autoloads file %s lacks boilerplate" buffer-file-name))
         (or (file-writable-p buffer-file-name)
             (error "Autoloads file %s is not writable" buffer-file-name))
         (widen)
@@ -652,6 +678,7 @@
 		  (t
                    (autoload-remove-section (match-beginning 0))
                    (if (autoload-generate-file-autoloads
+                        ;; Passing `current-buffer' makes it insert at point.
                         file (current-buffer) buffer-file-name)
                        (push file no-autoloads))))
             (push file done)
@@ -660,6 +687,9 @@
       (dolist (file files)
         (cond
          ((member (expand-file-name file) autoload-excludes) nil)
+         ;; Passing nil as second argument forces
+         ;; autoload-generate-file-autoloads to look for the right
+         ;; spot where to insert each autoloads section.
          ((autoload-generate-file-autoloads file nil buffer-file-name)
           (push file no-autoloads))))
 
--- a/lisp/loadup.el	Fri Apr 16 03:24:45 2010 +0000
+++ b/lisp/loadup.el	Sun Apr 18 22:46:37 2010 +0000
@@ -64,6 +64,10 @@
 			    (expand-file-name "international" dir)
 			    (expand-file-name "textmodes" dir)))))
 
+(if (eq t purify-flag)
+    ;; Hash consing saved around 11% of pure space in my tests.
+    (setq purify-flag (make-hash-table :test 'equal)))
+
 (message "Using load-path %s" load-path)
 
 (if (or (member (nth 3 command-line-args) '("dump" "bootstrap"))
@@ -345,6 +349,10 @@
 ;; At this point, we're ready to resume undo recording for scratch.
 (buffer-enable-undo "*scratch*")
 
+;; Avoid error if user loads some more libraries now and make sure the
+;; hash-consing hash table is GC'd.
+(setq purify-flag nil)
+
 (if (null (garbage-collect))
     (setq pure-space-overflow t))
 
@@ -378,9 +386,6 @@
 	    (add-name-to-file "emacs" name t)))
       (kill-emacs)))
 
-;; Avoid error if user loads some more libraries now.
-(setq purify-flag nil)
-
 ;; For machines with CANNOT_DUMP defined in config.h,
 ;; this file must be loaded each time Emacs is run.
 ;; So run the startup code now.  First, remove `-l loadup' from args.
--- a/lwlib/ChangeLog	Fri Apr 16 03:24:45 2010 +0000
+++ b/lwlib/ChangeLog	Sun Apr 18 22:46:37 2010 +0000
@@ -1,3 +1,34 @@
+2010-04-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xlwmenu.c: Include Shell.h, remove duplicate declaration of
+	XlwMenuRedisplay.
+	(display_menu_item): Replace ws->window with ws->pixmap, remove
+	call to XftDrawRect.
+	(display_menu): Remove this and that argument.  Remove
+	just_compute_this_one_p. Fill pixmap at start and copy it to window
+	at end.
+	(expose_cb): New function.
+	(make_windows_if_needed): Replace XCreateWindow with XtCreatePopup.
+	Add eventhandler for expose to expose_cb.  Remove creation of
+	xft_draw.
+	(create_pixmap_for_menu): New function.
+	(remap_menubar): Pop down menus that aren't the same as in old_stack.
+	Set width, heigh, x, y on widget with XtVaSetValues.  Call
+	create_pixmap_for_menu.
+	Replace XUnmapWindow with XtPopdown.
+	Remowe two last parameters to display_menu.
+	(map_event_to_widget_value, XlwMenuRedisplay, Key, Select)
+	(pop_up_menu): Remowe two last parameters to display_menu.
+	(XlwMenuRealize): Call create_pixmap_for_menu, set w and pixmap.
+	Remove call to XftDrawCreate.
+	(XlwMenuDestroy): Free pixmap.  Call XtDestroyWidget instead of
+	XDestroyWindow.
+	(handle_motion_event): Only call handle_single_motion_event once.
+	(set_window_type): New function.
+	(make_windows_if_needed, XlwMenuRealize): Call set_window_type.
+
+	* xlwmenuP.h (window_state): Add pixmap and w.
+
 2010-04-16  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* xlwmenu.c (facename_changed): Put function in #ifdef HAVE_XFT.
--- a/lwlib/xlwmenu.c	Fri Apr 16 03:24:45 2010 +0000
+++ b/lwlib/xlwmenu.c	Sun Apr 18 22:46:37 2010 +0000
@@ -44,6 +44,7 @@
 #include <X11/ObjectP.h>
 #include <X11/StringDefs.h>
 #include <X11/cursorfont.h>
+#include <X11/Shell.h>
 #include "xlwmenuP.h"
 
 #ifdef emacs
@@ -186,7 +187,6 @@
 
 static Boolean XlwMenuSetValues();
 static void XlwMenuRealize();
-static void XlwMenuRedisplay();
 static void XlwMenuResize();
 static void XlwMenuInitialize();
 static void XlwMenuRedisplay();
@@ -1067,13 +1067,13 @@
 
       if (separator_p)
 	{
-	  draw_separator (mw, ws->window, x, y, width, separator);
+	  draw_separator (mw, ws->pixmap, x, y, width, separator);
 	}
       else
 	{
 	  int x_offset = x + h_spacing + shadow;
 	  char* display_string = resource_widget_value (mw, val);
-	  draw_shadow_rectangle (mw, ws->window, x, y, width, height, True,
+	  draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height, True,
 				 False);
 
 	  /* Deal with centering a menu title. */
@@ -1092,9 +1092,6 @@
           if (ws->xft_draw)
             {
               int draw_y = y + v_spacing + shadow;
-              XftDrawRect (ws->xft_draw, &mw->menu.xft_bg,
-                           x_offset, draw_y,
-                           ws->width, font_height);
               XftDrawStringUtf8 (ws->xft_draw, xftfg,
                                  mw->menu.xft_font,
                                  x_offset, draw_y + font_ascent,
@@ -1105,13 +1102,13 @@
 #endif
 #ifdef HAVE_X_I18N
           if (mw->menu.fontSet)
-            XmbDrawString (XtDisplay (mw), ws->window, mw->menu.fontSet,
+            XmbDrawString (XtDisplay (mw), ws->pixmap, mw->menu.fontSet,
                            text_gc, x_offset,
                            y + v_spacing + shadow + font_ascent,
                            display_string, strlen (display_string));
           else
 #endif
-          XDrawString (XtDisplay (mw), ws->window,
+          XDrawString (XtDisplay (mw), ws->pixmap,
 		       text_gc, x_offset,
 		       y + v_spacing + shadow + font_ascent,
 		       display_string, strlen (display_string));
@@ -1119,16 +1116,16 @@
 	  if (!horizontal_p)
 	    {
 	      if (val->button_type == BUTTON_TYPE_TOGGLE)
-		draw_toggle (mw, ws->window, x, y + v_spacing + shadow,
+		draw_toggle (mw, ws->pixmap, x, y + v_spacing + shadow,
 			     val->selected);
 	      else if (val->button_type == BUTTON_TYPE_RADIO)
-		draw_radio (mw, ws->window, x, y + v_spacing + shadow,
+		draw_radio (mw, ws->pixmap, x, y + v_spacing + shadow,
 			    val->selected);
 
 	      if (val->contents)
 		{
 		  int a_w = arrow_width (mw);
-		  draw_arrow (mw, ws->window, deco_gc,
+		  draw_arrow (mw, ws->pixmap, deco_gc,
 			      x + width - a_w
 			      - mw->menu.horizontal_spacing
 			      - mw->menu.shadow_thickness,
@@ -1154,7 +1151,7 @@
 #endif
 #ifdef HAVE_X_I18N
                   if (mw->menu.fontSet)
-                    XmbDrawString (XtDisplay (mw), ws->window,
+                    XmbDrawString (XtDisplay (mw), ws->pixmap,
                                    mw->menu.fontSet,
                                    text_gc,
                                    x + label_width + mw->menu.arrow_spacing,
@@ -1162,7 +1159,7 @@
                                    val->key, strlen (val->key));
                   else
 #endif
-		  XDrawString (XtDisplay (mw), ws->window,
+		  XDrawString (XtDisplay (mw), ws->pixmap,
 			       text_gc,
 			       x + label_width + mw->menu.arrow_spacing,
 			       y + v_spacing + shadow + font_ascent,
@@ -1171,17 +1168,17 @@
 	    }
 	  else
 	    {
-	      XDrawRectangle (XtDisplay (mw), ws->window,
+	      XDrawRectangle (XtDisplay (mw), ws->pixmap,
 			      mw->menu.background_gc,
 			      x + shadow, y + shadow,
 			      label_width + h_spacing - 1,
 			      font_height + 2 * v_spacing - 1);
-	      draw_shadow_rectangle (mw, ws->window, x, y, width, height,
+	      draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height,
 				     True, False);
 	    }
 
 	  if (highlighted_p)
-	    draw_shadow_rectangle (mw, ws->window, x, y, width, height, False,
+	    draw_shadow_rectangle (mw, ws->pixmap, x, y, width, height, False,
 				   False);
 	}
     }
@@ -1191,16 +1188,13 @@
 }
 
 static void
-display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return,
-	      this, that)
+display_menu (mw, level, just_compute_p, highlighted_pos, hit, hit_return)
      XlwMenuWidget mw;
      int level;
      Boolean just_compute_p;
      XPoint* highlighted_pos;
      XPoint* hit;
      widget_value** hit_return;
-     widget_value* this;
-     widget_value* that;
 {
   widget_value*	val;
   widget_value* following_item;
@@ -1208,9 +1202,6 @@
   XPoint	where;
   int horizontal_p = mw->menu.horizontal && (level == 0);
   int highlighted_p;
-  int just_compute_this_one_p;
-  /* This is set nonzero if the element containing HIGHLIGHTED_POS
-     is disabled, so that we do not return any subsequent element either.  */
   int no_return = 0;
   enum menu_separator separator;
 
@@ -1229,6 +1220,11 @@
   where.y = 0;
 
   ws = &mw->menu.windows [level];
+
+  if (!just_compute_p)
+    XFillRectangle (XtDisplay (mw), ws->pixmap, mw->menu.background_gc,
+                    0, 0, ws->width, ws->height);
+
   for (val = mw->menu.old_stack [level]->contents; val; val = val->next)
     {
       highlighted_p = val == following_item;
@@ -1240,11 +1236,8 @@
 	    highlighted_pos->y = where.y;
 	}
 
-      just_compute_this_one_p =
-	just_compute_p || ((this || that) && val != this &&  val != that);
-
       display_menu_item (mw, val, ws, &where, highlighted_p, horizontal_p,
-			 just_compute_this_one_p);
+			 just_compute_p);
 
       if (highlighted_p && highlighted_pos)
 	{
@@ -1282,8 +1275,12 @@
     }
 
   if (!just_compute_p)
-    draw_shadow_rectangle (mw, ws->window, 0, 0, ws->width, ws->height,
-			   False, False);
+    {
+      draw_shadow_rectangle (mw, ws->pixmap, 0, 0, ws->width, ws->height,
+                             False, False);
+      XCopyArea (XtDisplay (mw), ws->pixmap, ws->window,
+                 mw->menu.foreground_gc, 0, 0, ws->width, ws->height, 0, 0);
+    }
 }
 
 /* Motion code */
@@ -1302,15 +1299,45 @@
 }
 
 static void
+expose_cb (Widget widget,
+           XtPointer closure,
+           XEvent* event,
+           Boolean* continue_to_dispatch)
+{
+  *continue_to_dispatch = False;
+  XlwMenuWidget mw = (XlwMenuWidget) closure;
+  int i;
+
+  for (i = 0; i < mw->menu.windows_length; ++i)
+    if (mw->menu.windows [i].w == widget) break;
+  if (i < mw->menu.windows_length && i < mw->menu.old_depth)
+    display_menu (mw, i, False, NULL, NULL, NULL, NULL, NULL);
+}
+
+static void
+set_window_type (Widget w, XlwMenuWidget mw)
+{
+  int popup_menu_p = mw->menu.top_depth == 1;
+  Atom type = XInternAtom (XtDisplay (w),
+                           popup_menu_p
+                           ? "_NET_WM_WINDOW_TYPE_POPUP_MENU"
+                           : "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
+                           False);
+
+  XChangeProperty (XtDisplay (w), XtWindow (w),
+                   XInternAtom (XtDisplay (w), "_NET_WM_WINDOW_TYPE", False),
+                   XA_ATOM, 32, PropModeReplace,
+                   (unsigned char *)&type, 1);
+}
+
+
+static void
 make_windows_if_needed (mw, n)
      XlwMenuWidget mw;
      int n;
 {
   int i;
   int start_at;
-  XSetWindowAttributes xswa;
-  int mask;
-  Window root = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
   window_state* windows;
 #ifdef HAVE_XFT
   int screen = XScreenNumberOfScreen (mw->core.screen);
@@ -1319,17 +1346,6 @@
   if (mw->menu.windows_length >= n)
     return;
 
-  xswa.save_under = True;
-  xswa.override_redirect = True;
-  xswa.background_pixel = mw->core.background_pixel;
-  xswa.border_pixel = mw->core.border_pixel;
-  xswa.event_mask =
-    ExposureMask | PointerMotionMask | PointerMotionHintMask
-      | ButtonReleaseMask | ButtonPressMask;
-  xswa.cursor = mw->menu.cursor_shape;
-  mask = CWSaveUnder | CWOverrideRedirect | CWBackPixel | CWBorderPixel
-    | CWEventMask | CWCursor;
-
   if (!mw->menu.windows)
     {
       mw->menu.windows =
@@ -1349,24 +1365,31 @@
 
   for (i = start_at; i < n; i++)
    {
+     Arg av[10];
+     int ac = 0;
      windows [i].x = 0;
      windows [i].y = 0;
      windows [i].width = 1;
      windows [i].height = 1;
      windows [i].max_rest_width = 0;
-     windows [i].window =
-       XCreateWindow (XtDisplay (mw), root, 0, 0, 1, 1,
-		      0, 0, CopyFromParent, CopyFromParent, mask, &xswa);
+     XtSetArg (av[ac], XtNwidth, 1); ++ac;
+     XtSetArg (av[ac], XtNheight, 1); ++ac;
+     XtSetArg (av[ac], XtNsaveUnder, True); ++ac;
+     XtSetArg (av[ac], XtNbackground, mw->core.background_pixel); ++ac;
+     XtSetArg (av[ac], XtNborderColor, mw->core.border_pixel); ++ac;
+     XtSetArg (av[ac], XtNborderWidth, mw->core.border_width); ++ac;
+     XtSetArg (av[ac], XtNcursor, mw->menu.cursor_shape); ++ac;
+     windows [i].w =
+       XtCreatePopupShell ("sub", overrideShellWidgetClass,
+                           (Widget) mw, av, ac);
+     XtRealizeWidget (windows [i].w);
+     XtAddEventHandler (windows [i].w, ExposureMask, False, expose_cb, mw);
+     windows [i].window = XtWindow (windows [i].w);
+     windows [i].pixmap = None;
 #ifdef HAVE_XFT
-     if (mw->menu.xft_font)
-       mw->menu.windows [i].xft_draw
-         = XftDrawCreate (XtDisplay (mw),
-                          windows [i].window,
-                          DefaultVisual (XtDisplay (mw), screen),
-                          mw->core.colormap);
-     else
-       mw->menu.windows [i].xft_draw = 0;
+     windows [i].xft_draw = 0;
 #endif
+     set_window_type (windows [i].w, mw);
    }
 }
 
@@ -1445,6 +1468,33 @@
     }
 }
 
+static void
+create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw)
+{
+  if (ws->pixmap != None) 
+    {
+      XFreePixmap (XtDisplay (ws->w), ws->pixmap);
+      ws->pixmap = None;
+    }
+  ws->pixmap = XCreatePixmap (XtDisplay (ws->w), ws->window,
+                              ws->width, ws->height,
+                              DefaultDepthOfScreen (XtScreen (ws->w)));
+#ifdef HAVE_XFT
+  if (ws->xft_draw)
+    XftDrawDestroy (ws->xft_draw);
+  if (mw->menu.xft_font)
+    {
+      int screen = XScreenNumberOfScreen (mw->core.screen);
+      ws->xft_draw = XftDrawCreate (XtDisplay (ws->w),
+                                    ws->pixmap,
+                                    DefaultVisual (XtDisplay (ws->w), screen),
+                                    mw->core.colormap);
+    }
+  else
+    ws->xft_draw = 0;
+#endif
+}
+
 /* Updates old_stack from new_stack and redisplays. */
 static void
 remap_menubar (mw)
@@ -1490,14 +1540,17 @@
   /* updates old_state from new_state.  It has to be done now because
      display_menu (called below) uses the old_stack to know what to display. */
   for (i = last_same + 1; i < new_depth; i++)
-    old_stack [i] = new_stack [i];
+    {
+      XtPopdown (mw->menu.windows [i].w);
+      old_stack [i] = new_stack [i];
+    }
   mw->menu.old_depth = new_depth;
 
   /* refresh the last selection */
   selection_position.x = 0;
   selection_position.y = 0;
   display_menu (mw, last_same, new_selection == old_selection,
-		&selection_position, NULL, NULL, old_selection, new_selection);
+		&selection_position, NULL, NULL);
 
   /* Now place the new menus.  */
   for (i = last_same + 1; i < new_depth && new_stack[i]->contents; i++)
@@ -1524,17 +1577,17 @@
 
       fit_to_screen (mw, ws, previous_ws, mw->menu.horizontal && i == 1);
 
-      XClearWindow (XtDisplay (mw), ws->window);
-      XMoveResizeWindow (XtDisplay (mw), ws->window, ws->x, ws->y,
-			 ws->width, ws->height);
-      XMapRaised (XtDisplay (mw), ws->window);
-      display_menu (mw, i, False, &selection_position, NULL, NULL, NULL, NULL);
+      XtVaSetValues (ws->w, XtNwidth, ws->width, XtNheight, ws->height,
+                     XtNx, ws->x, XtNy, ws->y, NULL);
+      create_pixmap_for_menu (ws, mw);
+      XtPopup (ws->w, XtGrabNone);
+      display_menu (mw, i, False, &selection_position, NULL, NULL);
     }
 
   /* unmap the menus that popped down */
   for (i = new_depth - 1; i < old_depth; i++)
     if (i >= new_depth || (i > 0 && !new_stack[i]->contents))
-      XUnmapWindow (XtDisplay (mw), windows[i].window);
+      XtPopdown (windows[i].w);
 }
 
 static Boolean
@@ -1575,7 +1628,7 @@
       if (ws && motion_event_is_in_menu (mw, ev, i, &relative_pos))
 	{
           inside = 1;
-	  display_menu (mw, i, True, NULL, &relative_pos, val, NULL, NULL);
+	  display_menu (mw, i, True, NULL, &relative_pos, val);
 
 	  if (*val)
 	    {
@@ -1954,6 +2007,7 @@
   mw->menu.windows [0].width = 0;
   mw->menu.windows [0].height = 0;
   mw->menu.windows [0].max_rest_width = 0;
+  mw->menu.windows [0].pixmap = None;
 #ifdef HAVE_XFT
   mw->menu.windows [0].xft_draw = 0;
 #endif
@@ -1996,22 +2050,20 @@
   x_uncatch_errors ();
 #endif
 
+  mw->menu.windows [0].w = w;
   mw->menu.windows [0].window = XtWindow (w);
   mw->menu.windows [0].x = w->core.x;
   mw->menu.windows [0].y = w->core.y;
   mw->menu.windows [0].width = w->core.width;
   mw->menu.windows [0].height = w->core.height;
 
+  set_window_type (mw->menu.windows [0].w, mw);
+  create_pixmap_for_menu (&mw->menu.windows [0], mw);
+
 #ifdef HAVE_XFT
   if (mw->menu.xft_font)
     {
       XColor colors[3];
-      int screen = XScreenNumberOfScreen (mw->core.screen);
-      mw->menu.windows [0].xft_draw
-        = XftDrawCreate (XtDisplay (w),
-                         mw->menu.windows [0].window,
-                         DefaultVisual (XtDisplay (w), screen),
-                         mw->core.colormap);
       colors[0].pixel = mw->menu.xft_fg.pixel = mw->menu.foreground;
       colors[1].pixel = mw->menu.xft_bg.pixel = mw->core.background_pixel;
       colors[2].pixel = mw->menu.xft_disabled_fg.pixel
@@ -2030,8 +2082,6 @@
       mw->menu.xft_disabled_fg.color.green = colors[2].green;
       mw->menu.xft_disabled_fg.color.blue = colors[2].blue;
     }
-  else
-    mw->menu.windows [0].xft_draw = 0;
 #endif
 }
 
@@ -2055,8 +2105,7 @@
       submenu_destroyed = 0;
     }
 
-  for (i = 0; i < mw->menu.old_depth; i++)
-    display_menu (mw, i, False, NULL, NULL, NULL, NULL, NULL);
+  display_menu (mw, 0, False, NULL, NULL, NULL);
 }
 
 
@@ -2121,10 +2170,14 @@
     XftFontClose (XtDisplay (mw), mw->menu.xft_font);
 #endif
 
+  if (mw->menu.windows [0].pixmap != None) 
+    XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap);
   /* start from 1 because the one in slot 0 is w->core.window */
   for (i = 1; i < mw->menu.windows_length; i++)
     {
-      XDestroyWindow (XtDisplay (mw), mw->menu.windows [i].window);
+      if (mw->menu.windows [i].pixmap != None) 
+        XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap);
+      XtDestroyWidget (mw->menu.windows [i].w);
 #ifdef HAVE_XFT
       if (mw->menu.windows [i].xft_draw)
         XftDrawDestroy (mw->menu.windows [i].xft_draw);
@@ -2140,7 +2193,7 @@
 facename_changed (XlwMenuWidget newmw,
                   XlwMenuWidget oldmw)
 {
-  /* This will fore a new XftFont even if the same sting is set.
+  /* This will fore a new XftFont even if the same string is set.
      This is good, as rendering parameters may have changed and
      we just want to do a redisplay.  */
   return newmw->menu.faceName != oldmw->menu.faceName;
@@ -2250,13 +2303,14 @@
       /* Don't allow the popup menu to resize itself.  */
       mw->core.width = mw->menu.windows [0].width;
       mw->core.height = mw->menu.windows [0].height;
-      mw->core.parent->core.width = mw->core.width ;
-      mw->core.parent->core.height = mw->core.height ;
+      mw->core.parent->core.width = mw->core.width;
+      mw->core.parent->core.height = mw->core.height;
     }
   else
     {
       mw->menu.windows [0].width = mw->core.width;
       mw->menu.windows [0].height = mw->core.height;
+      create_pixmap_for_menu (&mw->menu.windows [0], mw);
     }
 }
 
@@ -2287,8 +2341,7 @@
   int x = ev->x_root;
   int y = ev->y_root;
   int state = ev->state;
-
-  handle_single_motion_event (mw, ev);
+  XMotionEvent oldev = *ev;
 
   /* allow motion events to be generated again */
   if (ev->is_hint
@@ -2300,6 +2353,8 @@
       && ev->state == state
       && (ev->x_root != x || ev->y_root != y))
     handle_single_motion_event (mw, ev);
+  else
+    handle_single_motion_event (mw, &oldev);
 }
 
 static void
@@ -2609,7 +2664,7 @@
       else
 	{
 	  XtRemoveGrab ((Widget) mw);
-	  display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL);
+	  display_menu (mw, 0, False, NULL, NULL, NULL);
 	}
     }
 
@@ -2650,7 +2705,7 @@
       else
 	{
 	  XtRemoveGrab ((Widget) mw);
-	  display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL);
+	  display_menu (mw, 0, False, NULL, NULL, NULL);
 	}
     }
 
@@ -2701,7 +2756,7 @@
       XtConfigureWidget (XtParent ((Widget)mw), x, y, w, h,
 			 XtParent ((Widget)mw)->core.border_width);
       XtPopup (XtParent ((Widget)mw), XtGrabExclusive);
-      display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL);
+      display_menu (mw, 0, False, NULL, NULL, NULL);
       mw->menu.windows [0].x = x + borderwidth;
       mw->menu.windows [0].y = y + borderwidth;
       mw->menu.top_depth = 1;  /* Popup menus don't have a bar so top is 1  */
--- a/lwlib/xlwmenuP.h	Fri Apr 16 03:24:45 2010 +0000
+++ b/lwlib/xlwmenuP.h	Sun Apr 18 22:46:37 2010 +0000
@@ -32,7 +32,9 @@
 /* Elements in the stack arrays. */
 typedef struct _window_state
 {
+  Widget        w;
   Window	window;
+  Pixmap        pixmap;
   Position	x;
   Position	y;
   Dimension	width;
--- a/src/ChangeLog	Fri Apr 16 03:24:45 2010 +0000
+++ b/src/ChangeLog	Sun Apr 18 22:46:37 2010 +0000
@@ -1,3 +1,36 @@
+2010-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* alloc.c (Fpurecopy): Hash-cons if requested.
+	(syms_of_alloc): Update purify-flag docstring.
+
+2010-04-18  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (xg_set_geometry): Set size in geometry string also.
+	(x_wm_set_size_hint): Set USER_POS in hint_flags (Bug#5968).
+
+2010-04-17  Eli Zaretskii  <eliz@gnu.org>
+
+	Fix a crash when an NSM character is inserted at BEGV.
+
+	* bidi.c (bidi_init_it): Fix initialization of bidi_it->prev.
+	(bidi_resolve_weak): Don't use prev.type_after_w1 if it is
+	NEUTRAL_B or UNKNOWN_BT.
+
+2010-04-16  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (set_cursor_from_row): Don't consider possibility of
+	other rows with cursor unless they are different from this row and
+	this row is part of a continued line.  (Bug#5943)
+
+2010-04-16  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* s/freebsd.h: Restore osreldate.h include.
+	Suggested by Naohiro Aota.
+
+2010-04-16  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xmenu.c (apply_systemfont_to_menu): *childs was incorrectly used.
+
 2010-04-16  Ken Brown  <kbrown@cornell.edu>  (tiny change)
 
 	* s/cygwin.h: Avoid linking against static libgcc.
@@ -304,6 +337,11 @@
 	(gif_load): Put GIF extension data to the property
 	`Qextension_data'.
 
+2010-04-05  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xdisp.c (prepare_menu_bars): Don't call ns_set_doc_edited for
+	terminal frames (Bug#5837).
+
 2010-03-31  Chong Yidong  <cyd@stupidchicken.com>
 
 	* nsfns.m (ns_set_doc_edited): Remove unused arg OLDVAL.
--- a/src/alloc.c	Fri Apr 16 03:24:45 2010 +0000
+++ b/src/alloc.c	Sun Apr 18 22:46:37 2010 +0000
@@ -4893,14 +4893,21 @@
   if (PURE_POINTER_P (XPNTR (obj)))
     return obj;
 
+  if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing.  */
+    {
+      Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil);
+      if (!NILP (tmp))
+	return tmp;
+    }
+
   if (CONSP (obj))
-    return pure_cons (XCAR (obj), XCDR (obj));
+    obj = pure_cons (XCAR (obj), XCDR (obj));
   else if (FLOATP (obj))
-    return make_pure_float (XFLOAT_DATA (obj));
+    obj = make_pure_float (XFLOAT_DATA (obj));
   else if (STRINGP (obj))
-    return make_pure_string (SDATA (obj), SCHARS (obj),
-			     SBYTES (obj),
-			     STRING_MULTIBYTE (obj));
+    obj = make_pure_string (SDATA (obj), SCHARS (obj),
+			    SBYTES (obj),
+			    STRING_MULTIBYTE (obj));
   else if (COMPILEDP (obj) || VECTORP (obj))
     {
       register struct Lisp_Vector *vec;
@@ -4920,10 +4927,15 @@
 	}
       else
 	XSETVECTOR (obj, vec);
-      return obj;
     }
   else if (MARKERP (obj))
     error ("Attempt to copy a marker to pure storage");
+  else
+    /* Not purified, don't hash-cons.  */
+    return obj;
+
+  if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing.  */
+    Fputhash (obj, obj, Vpurify_flag);
 
   return obj;
 }
@@ -6371,7 +6383,9 @@
 
   DEFVAR_LISP ("purify-flag", &Vpurify_flag,
 	       doc: /* Non-nil means loading Lisp code in order to dump an executable.
-This means that certain objects should be allocated in shared (pure) space.  */);
+This means that certain objects should be allocated in shared (pure) space.
+It can also be set to a hash-table, in which case this table is used to
+do hash-consing of the objects allocated to pure space.  */);
 
   DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages,
 	       doc: /* Non-nil means display messages at start and end of garbage collection.  */);
--- a/src/bidi.c	Fri Apr 16 03:24:45 2010 +0000
+++ b/src/bidi.c	Sun Apr 18 22:46:37 2010 +0000
@@ -976,10 +976,11 @@
   bidi_it->new_paragraph = 1;
   bidi_it->separator_limit = -1;
   bidi_it->type = NEUTRAL_B;
-  bidi_it->type_after_w1 = UNKNOWN_BT;
-  bidi_it->orig_type = UNKNOWN_BT;
+  bidi_it->type_after_w1 = NEUTRAL_B;
+  bidi_it->orig_type = NEUTRAL_B;
   bidi_it->prev_was_pdf = 0;
-  bidi_it->prev.type = bidi_it->prev.type_after_w1 = UNKNOWN_BT;
+  bidi_it->prev.type = bidi_it->prev.type_after_w1 =
+    bidi_it->prev.orig_type = UNKNOWN_BT;
   bidi_it->last_strong.type = bidi_it->last_strong.type_after_w1 =
     bidi_it->last_strong.orig_type = UNKNOWN_BT;
   bidi_it->next_for_neutral.charpos = -1;
@@ -1353,7 +1354,9 @@
 	     current level run, and thus not relevant to this NSM.
 	     This is why NSM gets the type_after_w1 of the previous
 	     character.  */
-	  if (bidi_it->prev.type != UNKNOWN_BT)
+	  if (bidi_it->prev.type_after_w1 != UNKNOWN_BT
+	      /* if type_after_w1 is NEUTRAL_B, this NSM is at sor */
+	      && bidi_it->prev.type_after_w1 != NEUTRAL_B)
 	    type = bidi_it->prev.type_after_w1;
 	  else if (bidi_it->sor == R2L)
 	    type = STRONG_R;
--- a/src/gtkutil.c	Fri Apr 16 03:24:45 2010 +0000
+++ b/src/gtkutil.c	Sun Apr 18 22:46:37 2010 +0000
@@ -542,7 +542,9 @@
       if (yneg)
         top = -top;
 
-      sprintf (geom_str, "%c%d%c%d",
+      sprintf (geom_str, "=%dx%d%c%d%c%d",
+               FRAME_PIXEL_WIDTH (f),
+               FRAME_PIXEL_HEIGHT (f),
                (xneg ? '-' : '+'), left,
                (yneg ? '-' : '+'), top);
 
@@ -951,6 +953,12 @@
   else if (win_gravity == StaticGravity)
     size_hints.win_gravity = GDK_GRAVITY_STATIC;
 
+  if (user_position)
+    {
+      hint_flags &= ~GDK_HINT_POS;
+      hint_flags |= GDK_HINT_USER_POS;
+    }
+
   if (hint_flags != f->output_data.x->hint_flags
       || memcmp (&size_hints,
 		 &f->output_data.x->size_hints,
--- a/src/s/freebsd.h	Fri Apr 16 03:24:45 2010 +0000
+++ b/src/s/freebsd.h	Sun Apr 18 22:46:37 2010 +0000
@@ -23,6 +23,8 @@
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <osreldate.h>
+
 /* Get most of the stuff from bsd-common */
 #include "bsd-common.h"
 
--- a/src/xdisp.c	Fri Apr 16 03:24:45 2010 +0000
+++ b/src/xdisp.c	Sun Apr 18 22:46:37 2010 +0000
@@ -9831,7 +9831,8 @@
 	  update_tool_bar (f, 0);
 #endif
 #ifdef HAVE_NS
-          if (windows_or_buffers_changed)
+          if (windows_or_buffers_changed
+	      && FRAME_NS_P (f))
             ns_set_doc_edited (f, Fbuffer_modified_p
 			       (XWINDOW (f->selected_window)->buffer));
 #endif
@@ -12925,7 +12926,12 @@
      rows whose start and end charpos occlude point.  Only set
      w->cursor if we found a better approximation to the cursor
      position than we have from previously examined rows.  */
-  if (w->cursor.vpos >= 0
+  if (/* we already have a candidate row */
+      w->cursor.vpos >= 0
+      /* that candidate is not the row we are processing */
+      && MATRIX_ROW (matrix, w->cursor.vpos) != row
+      /* this row is part of a continued line */
+      && (row->continued_p || row->continuation_lines_width)
       /* Make sure cursor.vpos specifies a row whose start and end
 	 charpos occlude point.  This is because some callers of this
 	 function leave cursor.vpos at the row where the cursor was
--- a/src/xmenu.c	Fri Apr 16 03:24:45 2010 +0000
+++ b/src/xmenu.c	Sun Apr 18 22:46:37 2010 +0000
@@ -978,14 +978,9 @@
   if (XtIsShell (w)) /* popup menu */
     {
       Widget *childs = NULL;
-      int num = 0;
-
-      XtVaGetValues (w, XtNnumChildren, &num, NULL);
-      if (num != 1) return; /* Should only be one. */
-
-      childs[0] = 0;
+
       XtVaGetValues (w, XtNchildren, &childs, NULL);
-      if (childs && *childs) w = *childs;
+      if (*childs) w = *childs;
     }
 
   /* Only use system font if the default is used for the menu.  */