0

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.

  • 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
2

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.