How I use Emacs
I've recently written two posts about my attempts to use a slimmed down Emacs
setup for some very specific use cases. I'be put both posts on Reddit, here and
here, and in both cases the majority of comments have been telling me that I
should use emacsclient
. I know they have good intentions – they want to share
insight they've gained and benefit from on a daily basis. However, no matter how
many Emacs devotees point out the benefits of emacsclient
I'm not about to
start using it. This post is an attempt to answer why that is.
Up front I want to clarify a few things:
- Yes, I know how to use
emacsclient
, and - yes, I know it is a good way to, in a way, improve Emacs startup time,1 and
- yes, I know how to turn on
server-mode
in Emacs, and finally - yes, I know how to run Emacs using a user unit for SystemD.
With that out of the way, here are the two ways I use Emacs
- As my starting point for work, i.e. writing code, keeping notes, tracking time, and writing my daily work journal.
- As my editor of ephemeral files.2
The next two sections explain more about these two distinct ways I use Emacs
As my starting point for work
Number of packages | 162 |
Init time (emacs-init-time ) |
1.883483s |
Config size (by du -bch ) |
68K |
Much of what I do on a daily basis starts in Emacs. I typically have one
instance of Emacs open and I always keep it on the second virtual desktop. I
always run it in the GUI. When I write code I start with opening a new tab, then
I open a dired
buffer in the project's folder (by using consult-projectile
).
When I need a terminal I open it from Emacs using on of
terminal-here-project-launch
or terminal-here
. Occasionally I open a shell
prompt inside Emacs using shell-pop
.
Back when I used Vim as my main editor I always started a terminal first and
then opened files from there. Since switching to Emacs I've completely stopped
doing that. Over the last 8 or so years of Emacs usage there's only been a
handful of times when I've wanted to open a file from the terminal and I've run
M-x server-start
and used emacsclient
. The last time was more than a year
ago.
As I typically keep exactly one Emacs open, and I start it soon after logging in, I'm not too concerned with startup time. I think under 2s is more than fast enough given the functionality I have in my setup.
This setup I use for taking notes and writing my daily work journal, as well as reading email, and programming in a half-dozen languages. I have a large-ish set of keybindings that I've set up using general.el, inspired by Spacemacs at first but by now it's started to gain its own character.
As my editor of ephemeral files ($EDITOR
)
Number of packages | 22 |
Init time (emacs-init-time ) |
0.209298s |
Config size (by du -bch ) |
6.7K |
Ephemeral files are files I tend to edit for less than 30 seconds, maybe a minute at most. There are three main use cases for ephemeral files:
- Searching the scrollback buffer in zellij, and copying bits to the clipboard for various uses.
- Editing files when running
git
from the command line. It's not something I do very often, but it happens. - Editing shell commands. When they get a little too large to handle
conveniently using ZSH directly I invoke
edit-command-line
.
For a few reasons I decided to make a second, completely separate configuration just to handle ephemeral files.
- It will only be used in a terminal.
- I want to be able to have some special keybindings that suit a specific use, e.g. for the scrollback buffer I've bound `SPC Y` to copy the selected text to the clipboard and then exit Emacs. It's a thing that I use all the time with the scrollback buffer, but never otherwise.
- I have no need, nor any desire, to switch from editing a commit message, or searching a scrollback buffer, to reading email or editing an org-mode file. The complete separation is a feature.
With a startup time of less than a quarter of a second it is well within the
acceptable, and there is absolutely no need to use emacsclient
just to speed
things up. Given my desire for separation, I wouldn't want to use my main Emacs
instance as a server and edit ephemeral files anyway.
Conclusion
I've found a setup that seems to work really well and tick all the requirements
I have when it comes to separation between use cases and ability to have custom
keybindings for them. Also, Emacs is starting up very fast with my slimmed
down configuration. If starting Emacs with the slimmed configuration starts
taking too long I'm more likely to go back to using Neovim than complicate
things with emacsclient
.
So no, I am not going to start using emacsclient
any time soon.