I like a clean interface. One without the clutter of scroll bars, or menu bars. So, to remove them, I have the following in my init.el

  (menu-bar-mode -1)
  (scroll-bar-mode -1)
  (tooltip-mode -1)
  (tool-bar-mode -1)
  (set-face-attribute 'default nil :height 150))

However, these 5 lines are slow. I profiled my startup using esup. And this is what I found

Total User Startup Time: 0.498sec     Total Number of GC Pauses: 0     Total GC Time: 0.000sec

init.el:10  0.231sec   46%
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tooltip-mode -1)
(tool-bar-mode -1)
(set-face-attribute 'default nil :height 150))

Half of my startup time comes from these 5 lines. Is there any way I can accomplish these same tasks faster? Specifically the menu, scroll, tooltip, and toolbar. Those seem like they should be very quick operations.

Ps. Yes, I know if you use emacsclient, the startup time doesn't matter. But, that's not what this question is about.

Edit: I checked the time for each line individually. Here are the results:

(menu-bar-mode -1)    ;; 0.032sec
(scroll-bar-mode -1)  ;; 0.105sec
(tooltip-mode -1)     ;; 0.000sec
(tool-bar-mode -1)    ;; 0.000sec
(set-face-attribute 'default nil :height 150) ;; 0.120sec

So, I guess I need to rephrase my question. How can I disable the scroll-bar faster?

  • Does setting the default font, size and face as part of the default-frame-alist and initial-frame-alist save you any time on startup, instead of using set-face-attribute? Here is a link to an example of frame parameters that can be used with the aforementioned variables: emacs.stackexchange.com/a/17354/2287
    – lawlist
    Feb 28, 2019 at 2:29
  • Which of those five lines is causing the most time to be taken? There's no point speeding up, say, disabling the menu bars if that only takes 1ms.
    – zck
    Feb 28, 2019 at 3:12
  • 2
    You could try compiling emacs using configure --without-toolkit-scroll-bars to find out whether that makes a difference.
    – phils
    Feb 28, 2019 at 3:56
  • 3
    Even if your Emacs has been built with scroll bars (and you don't want to build your own Emacs without them), you can control their presence, as well as that of menu bars and tool bars, using resources. See (emacs) X Resources, (efaq) Emacs ignores X resources, (elisp) Resources, and the Emacs manpage.
    – Basil
    Feb 28, 2019 at 17:50
  • 1
    The x resources was fantastic. It was simple to do, and cut the startup time in half Mar 1, 2019 at 20:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.