What would be the correct way to configure my .emacs file to e.g. check for package updates in a background process?
What would be the correct way to configure my .emacs file to e.g. check for package updates in a background process?
You could also make a script that starts emacs as a client only if a server already is running
#!/bin/sh
if [ "$#" -eq 0 ]
then
echo "Starting new Emacs process ..." >&2
nohup emacs > /dev/null 2>&1 &
elif emacsclient -n "$@" 2> /dev/null
then
echo "Opened $@ in Emacs server" >&2
else
echo "Opening $@ in a new Emacs process ..." >&2
nohup emacs "$@" > /dev/null 2>&1 &
fi
(Copied from an emacs starter kit but don't remember which...)I’m not saying there’s something wrong with leaving Emacs running. But it’s a workaround. When I used Emacs, startup time was not a problem. But I didn’t use a bunch of packages.
Apart from that, without too many paclages stsrtup time is not an issue imo
> or an acceptance of “fit your workflow around Emacs” than it is truly a solution, which would be to reduce startup times.
I don't see a problem with this. Emacs is a general purpose platform, and it's silly to expect really fast startup times if you're using it as a general purpose platform. People aren't expecting Linux to have an instant startup time if you have a large number of services running - why expect it from Emacs?
(Of course it doesn't really use no resources - it consumes a finite PID among other things)
For what its worth, I've got at least 23 (service --status-all) daemons already running on this desktop. So leaving things running in the background until they are needed has precedent.
I normally never exit Emacs. This is not because of startup time. To me it's like the web browser; I use it all the time, have a workspace dedicated to it and it's natural to keep lots of buffers open. My muscle memory takes care of jumping between open buffers.
From the man page:
-a, --alternate-editor=COMMAND
If the Emacs server is not running, run the specified shell command instead. This can also be specified via the ALTERNATE_EDITOR environment variable. If the value of ALTERNATE_EDITOR is the empty string, run
"emacs --daemon" to start Emacs in daemon mode, and try to connect to it.Nope, it for sure does not.
I might look at the doom config and try to divine how they're getting such fast loading times. Thank you for the suggestion.
$ grep csv ~/.emacs
'(package-selected-packages '(csv-mode org-evil dash)))
If I want evil all the time but csv only when needed, I should change that to the following? '(package-selected-packages '(org-evil dash)))
'(use-package '(csv-mode)))(use-package org-evil :ensure t ;; download if not present :defer t ;; defer loading hook (org-mode . org-evil-mode)) ;; start this mode in org buffers
(use-package csv :ensure t :defer t) ;; modes are usually smart enough to know in which buffer they start
and so on for all your packages. If you NEED something to start when Emacs open, you can remove the `:defer t` macro. There are also other useful things like `:init` `:config` `custom`, you should check out the docs!
You can set
(setq use-package-always-defer t)
so anything you load with use-package will only be loaded on-demand. Or you can do it per package with e.g. `(use-package csv-mode :defer t)`.Also make sure you don't set use-package-always-ensure and don't `:ensure t` or it'll try to install anything that's not installed on startup. If you want fast startup, it's better to explicitly install with M-x package-install