Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I start an emacs daemon which I connect to both from long-lived GUI emacs frames and short-lived tty emacs frames. I currently use the following in my .emacs.d/init.el:

(if (not window-system) (menu-bar-mode 0))

Unfortunately this is a global setting so it applies to all frames. I'd prefer to have the menu only on my GUI frames; the menu takes up too much space on tty frames.

Is there a way of making this setting frame-specific?

Thanks.

share|improve this question
    
While I agree that this question is appropriate to SuperUser, I think you might have better luck on StackOverflow. Unfortunately, the SO crowd may punt it back here. – Benjamin Pollack Jul 19 '10 at 15:30
up vote 1 down vote accepted

The setting is frame-specific: each frame has a menu-bar-lines parameter. In fact menu-bar-mode loops through all frames to set this parameter. To set the parameter for a the current frame:

(set-frame-parameter (selected-frame) 'menu-bar-lines 1) ; or 0 for off

The next step is to set the parameter each time a frame is created:

(defun set-frame-menu-bar-lines (frame)
  (let ((want-menu (memq (framep frame) '(x w32 ns))))
    (set-frame-parameter frame 'menu-bar-lines (if want-menu 1 0))))
(add-hook 'after-make-frame-functions 'set-frame-menu-bar-lines)
share|improve this answer
    
That worked perfectly. Thanks. – Mike Crowe Jul 20 '10 at 8:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .