Subject: RE: bug#43383: 26.3; `toggle-menu-bar-mode-from-frame'

From: Drew Adams <[email-masked]>
Date: Wed, 16 Sep 2020 17:09:06 +0000 (UTC)

> > > I think this command indeed has a bug, in that it cannot disable the
> > > menu bar only on the frame from which it is invoked.  It _can_ enable
> > > the menu bar on a single frame, see my response to Drew.  So I think
> > > this command needs to be improved.  But that's another issue; the doc
> > > string definitely needs to be improved.  Will you do that, or should
> > > I?
> >
> > Please go ahead.
> 
> Done.
> 
> I'm not closing the bug, because I think we should make the command
> work according to documentation: toggle the menu bar only on the frame
> from which the command is invoked.  I think it should manipulate the
> menu-bar-lines frame parameter instead of invoking menu-bar mode.
> 
> Patches welcome.

Isn't that what the code I sent does?  Here it is again:

(defun toggle-menu-bar-for-frame (&optional frame)
  "Toggle showing the menu-bar for selected frame.
When called from Lisp, optional arg FRAME is used instead of the
selected frame."
  (interactive)
  (let ((now  (or (frame-parameter frame 'menu-bar-lines)  0)))
    (set-frame-parameter frame 'menu-bar-lines (if (zerop now) 1 0))))