My emacs installation has over time grown so that the startup has started taking multiple seconds. The only feasible way to run emacs then is in daemon mode and then connecting with emacsclient. In my init.el I have the following snippet:
(lambda ()
(when (display-graphic-p)
(set-scroll-bar-mode 'right)
(menu-bar-mode -1)
(tool-bar-mode -1)))
This runs once on startup and and removes the toolbars atop graphical emacs, along with putting the scroll bar on the right hand side of the window. But in terminal emacs set-scroll-bar-mode is undefined, hence the surrounding if-statement.
The problem then is that this code runs on emacs startup, not when a client connects to the emacs daemon. Where do I hook up this function so that it's run for every new emacsclient that connects.
-e
flag to run elisp code withemacsclient
. Example:emacsclient -c -e "(menu-bar-mode -1)(tool-bar-mode -1)"
scroll-bar-mode
is defined in terminal mode butset-scroll-bar-mode
is not? It seems odd that you can enable/disable scroll bars but not set which side they will be on. Possibly a bug?require
) libraries up front, before they are actually needed. Emacs provides theautoload
andeval-after-load
mechanisms which enable you to avoid loading libraries unnecessarily. Start learning about those if you're interested in a faster start time.