1

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

(progn
  (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%
(progn
(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?

Drew
  • 75,699
  • 9
  • 109
  • 225
user1762507
  • 111
  • 2
  • 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: https://emacs.stackexchange.com/a/17354/2287 – lawlist Feb 28 '19 at 02: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 '19 at 03:12
  • Are those time-measurement taken in the case where you start an Emacs daemon, or when you start a GUI session? – Stefan Feb 28 '19 at 03:38
  • These times are for starting a Gui session – user1762507 Feb 28 '19 at 03:42
  • 2
    You could try compiling emacs using `configure --without-toolkit-scroll-bars` to find out whether that makes a difference. – phils Feb 28 '19 at 03:56
  • If you're using emacsclient, then I recommend you start a *daemon* and measure those start time in the case where you start a daemon: they may turn out to be very different in that case (which is the case you care about). – Stefan Feb 28 '19 at 12:59
  • 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`](https://www.gnu.org/software/emacs/manual/html_node/emacs/X-Resources.html), [`(efaq) Emacs ignores X resources`](https://www.gnu.org/software/emacs/manual/html_node/efaq/Emacs-ignores-X-resources.html), [`(elisp) Resources`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Resources.html), and the [Emacs manpage](https://linux.die.net/man/1/emacs). – Basil Feb 28 '19 at 17:50
  • 1
    The x resources was fantastic. It was simple to do, and cut the startup time in half – user1762507 Mar 01 '19 at 20:35
  • I had no clue you could use that for emacs – user1762507 Mar 01 '19 at 20:36

0 Answers0