Opening the Emacs Initialization File, or First Impressions Matter
08 May 2025 Charles Choi
In working on the on-boarding for Scrim, I’ve recently had to consider the scenario of setting up a fresh install of GNU Emacs on macOS (as of this writing v30.1). A number of things struck me, particularly on the user experience (or lack thereof) for new users of Emacs, nearly all of whom will be unfamiliar to Emacs commands and keybindings.
- There is no dedicated command to load the Emacs initialization file (in this case
~/.emacs
, which has yet to be created). - Using the menu bar (File › Open File…) will open a macOS File Browser dialog window, but does not show hidden files (like
.emacs
) by default. - The
customize-variable
command only works on variables that have been loaded.
On point 1, it’s striking to me that this hasn’t been done already like… decades ago. New users won’t know a priori what the Emacs initialization file is (sidestepping the inside baseball of .emacs
vs init.el
) much less that such a file is not immediately created at the first launch of Emacs but the ~/.emacs.d/
directory is.
Further exacerbating this is point 2, where the menu bar action File › Open File… will open a native macOS file dialog instead of running find-file
. However this dialog is not configured to show hidden files. When the dialog is raised, the user can use the macOS key-binding Command + Shift + .
to show hidden files, but this is hardly a discoverable feature.
On point 3, while I’ve long been an advocate for using customize-variable
, it fails for variables that are not autoloaded (in this case server-use-tcp
). A partial work-around is to run the command describe-variable
which should implicitly load the package containing a non-autoloaded variable in order to describe it (although I would not be surprised if there are cases where you really have to load the package via require
). Once the variable is described, a link is provided to customize it. Arguably, such details should never be surfaced to a new user.
Going back the lack of a dedicated command to load the Emacs initialization file, here’s some Elisp that implements it. Note that the variable user-init-file
is already set to ~/.emacs
for a fresh install.
1 2 3 4 |
|
For most experienced Emacs users, this command has little value but it's not meant for them. It's meant for new users and should be built-in. First impressions matter!