7

(tool-bar-mode 0) takes up 11% of my initialization time (about a third of a second). It's not that big of a deal; it's just strange. I've tried it on multiple computers. I've also tried disabling everything but that line in my .emacs. It always takes a while.

Is this normal? Is there a better way to do it?

Drew
  • 75,699
  • 9
  • 109
  • 225
Matthew Piziak
  • 5,958
  • 3
  • 29
  • 77
  • How do you *know* it's this line? What version of Emacs is this? I'd like to see if I can reproduce this. –  Feb 25 '15 at 21:01
  • 1
    I first noticed it when I was profiling my `.emacs`. I ran that line by itself by commenting everything out, with the same result. I have tried `24.4 stable` and `25.0 snapshot`, on Windows and Ubuntu respectively. – Matthew Piziak Feb 25 '15 at 21:05
  • After adding the line to my init.el, the initialization time still comes out to be the same. Are you checking the time with M-x emacs-init-time? – gkumar7 Feb 25 '15 at 23:21
  • 1
    Yep. With an empty init file, `emacs-init-time` takes 0.5 seconds. With `(tool-bar-mode 0)`, it takes 0.8 seconds. – Matthew Piziak Feb 25 '15 at 23:25
  • To be clear, I'm aware that 0.3 seconds is pretty trivial. I just find it strangely out of place with the relative speed of comparable Emacs customizations. – Matthew Piziak Feb 25 '15 at 23:38
  • 3
    Set `Emacs.toolBar: 0` in *~/.Xresources* file. Any modification related to X window will be faster that way, because it will be applied *before* window is created|mapped. – kmicu Feb 26 '15 at 22:17
  • No change. I don't have an existing `~/.Xresources` file, so I created one. Do I have to do something specific so that Emacs loads it? I'm on Ubuntu 12.04. – Matthew Piziak Feb 26 '15 at 22:21
  • I've also tried `emacs24.toolBar: 0` – Matthew Piziak Feb 26 '15 at 22:26
  • Hello. Try: `Emacs*toolBar: false` – undostres Feb 28 '15 at 02:48
  • I think you need to `xrdb -merge ~/.Xresouces` before starting Emacs. – npostavs Apr 05 '15 at 21:13
  • You could always use my technique...my init file is now so complicated that an extra .3 secs is negligible. :-) I just don't start emacs that often. When I was working on a daily basis, it was started as part of the login, while I was off getting the day's first can of Mt. Dew. By the time I got back, everything was running...now that I'm a consultant working from home I only start an emacs when there's a power failure (current emacs has been running for about 2 months from an early May storm outage) still started from login. – MAP Jul 05 '16 at 08:44
  • I've no idea whether it makes a difference, but which X toolkit are you using? Have you tried compiling emacs with a different one? – phils Dec 04 '17 at 21:25

1 Answers1

5

A slightly less general but simpler version of what tool-bar-mode does:

(push '(tool-bar-lines . 0) default-frame-alist)

The same can be done with menu-bar-mode and the menu-bar-lines frame parameter, if you are interested.

Note that this will likely only shave a few cycles, if any. :)

Basil
  • 12,019
  • 43
  • 69