Subject: Re: bug#1077: 23.0.60; x-create-frame: (wrong-type-argument number-or-marker-p nil)

From: Eli Zaretskii <[email-masked]>
Date: Mon, 29 Nov 2010 23:18:34 +0200

> Date: Mon, 29 Nov 2010 21:14:27 +0100
> From: martin rudalics <[email-masked]>
> CC: [email-masked], [email-masked]
> 
>  > The frame we are creating is not yet ready, and is certainly not yet
>  > the selected frame!  Isn't that a bug? shouldn't we use
>  > menu-updating-frame instead of nil, in the above call to
>  > frame-parameter?
> 
> I think so.  Hopefully `menu-updating-frame' has the correct parameters
> in place.

Any objections to the patch below?  It fixes the error and the
following crash with Drew's recipe.

=== modified file 'lisp/menu-bar.el'
--- lisp/menu-bar.el	2010-08-13 13:26:13 +0000
+++ lisp/menu-bar.el	2010-11-29 21:08:59 +0000
@@ -966,7 +966,9 @@ mail status in mode line"))
 (define-key menu-bar-showhide-menu [menu-bar-mode]
   `(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame
 	      :help ,(purecopy "Turn menu-bar on/off")
-	      :button (:toggle . (> (frame-parameter nil 'menu-bar-lines) 0))))
+	      :button (:toggle . (> (frame-parameter (or menu-updating-frame
+							 (selected-frame))
+						     'menu-bar-lines) 0))))
 
 (defun menu-bar-set-tool-bar-position (position)
   (customize-set-variable 'tool-bar-mode t)