Son of the Wai-Pan
Son of the Wai-Pan

Reputation: 13191

How do I display the menu-bar in emacs every time I start up?

I put this in my .emacs file:

(custom-set-variables                                                                          
 '(gud-gdb-command-name "gdb --annotate=1")
 '(large-file-warning-threshold nil)
 '(menu-bar-mode t)
 '(shell-dirtrack-verbose nil))
(custom-set-faces                                                                         
 )
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

Note the (menu-bar-mode t). When I fire up emacs, I have to M-x menu-bar-mode to get a menu bar. I am running GNU Emacs 22.1.1 (mac-apple-darwin, Carbon Version 1.6.0)

Upvotes: 1

Views: 2627

Answers (3)

phils
phils

Reputation: 73274

You should consider upgrading to the latest GNU Emacs:

emacsformacosx.com

Upvotes: 1

phils
phils

Reputation: 73274

The documentation for the associated function says:

With a numeric argument, if the argument is positive,
turn on menu bars; otherwise, turn off menu bars.

So you could try (menu-bar-mode 1) instead of (menu-bar-mode t)

That said, for me (Emacs 23.2.1), setting this via M-x customize-variable menu-bar-mode results in the same entry in my custom-set-variables as you show there, and it has the desired effect when I restart.

There could be a difference between versions of Emacs, though. Did you type that manually? The recommendation is to only use the customize interface for making changes, as making a mistake might break things. Or possibly one of your other settings is invalid?

(In Emacs 23.2.1 I can't customize a gud-gdb-command-name or shell-dirtrack-verbose variable, for instance. OTOH I would presume it's still possible to customize variables from libraries which are only loaded on demand, so this probably doesn't mean anything.)

You could comment out everything else in your customize-variable if you wanted to check this (but watch out for that final closing parenthesis :)

Upvotes: 3

offby1
offby1

Reputation: 6983

I don't think (menu-bar-mode 1) belongs inside of custom-set-variables. Instead, put it outside, just like your call to add-hook:

(custom-set-variables
 '(gud-gdb-command-name "gdb --annotate=1")
 '(large-file-warning-threshold nil)
 '(shell-dirtrack-verbose nil))
(custom-set-faces
 )
(menu-bar-mode 1)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

Upvotes: 0

Related Questions