There have been a number of discussions recently about modernising Emacs. Some people feel that Emacs is not aesthetically pleasing, while others feel that Emacs’s default key-bindings put off potential newcomers.
In these discussions, I normally see comments fall into two main groups: -
- People who are proficient with Emacs and do not want the quest for new users to interfere with their way of using Emacs; and
- People who want to welcome new users and for Emacs to be used by as many people as possible.
I agree with both groups to some extent. I consider myself a proficient Emacs user who is comfortable with the defaults and with changing them myself where necessary. However, when viewed through the eyes of a beginner, I do see Emacs as intimidating.
I strongly agree that Emacs should remain as it is and I wouldn’t want to introduce simplifications just to cater to people who might want to use it. I also don’t think that Emacs should unnecessarily try to follow the latest trends just to be “up to date”. I do however think that we can do more to provide a pathway for newcomers to follow, so this post will explore one idea for doing just that.
An Emacs set-up wizard
The best idea I’ve seen in these discussions is for an Emacs set-up wizard of some kind. I like this idea, so I’ve created a small prototype to demonstrate how a feature like this could be implemented.
This wizard has the following important goals: -
- It should be an obvious first step for first-time users; and
- It should not interfere with seasoned users and those who already have their own configuration.
In order to illustrate, I have created a simple Emacs Lisp module called
emacs_wizard.el. This implements much of the wizard’s interface as described in this post, but does not actually generate configurations. It’s merely an example at this stage.
Of course for this idea to come to fruition this module would have to become a part of core Emacs. It would be pointless to distribute this as an installable module as the purpose of it is to be available to those who have no idea how to install external modules.
Running the prototype
Simply clone the GitHub repository or download the
emacs_wizard.el file from it and place it somewhere such as your home directory. Then, execute Emacs without loading a configuration file and load this file (assuming it is in your home directory) instead: -
emacs -q -l ~/emacs_wizard.el
Why might new users need a wizard?
One of the complaints I hear is that Emacs by default does not use Common User Access (CUA) key bindings by default. This standard, developed by IBM in 1987, defines common user-interface mechanisms for performing common tasks. For example, CUA defines that cut/copy/paste operations be bound to common keys such as
Emacs was developed before these CUA guidelines were first published, so the key bindings and terminology that Emacs uses pre-dates these specifications. However, Emacs does come with a mode called
cua-mode, which implements some of the specification within Emacs. Also, Emacs is completely customisable, so it can be made to work in whatever way you want.
So why don’t new users just use
cua-mode? Well, here’s the contradiction.
cua-mode can be thought of as a mode to help newcomers to transition to Emacs from other applications while keeping some of their familiar key bindings. However, these new users are the very users that would not use
cua-mode; they are unlikely to know that it exists, what a “mode” is, how to activate it and how to modify their configuration so that it’s always activated automatically.
What about Vim users hoping to move to Emacs? The excellent
evil-mode is available which effectively implements Vim within Emacs. However, Vim users who are new to Emacs might not know how to use this or that it even exists.
I therefore think that a simple wizard would be beneficial to these types of users as a way to introduce them to these modes which will make Emacs behave in the way that they want without them having to learn the ins and outs of Emacs first.
Goal 1: be obvious to first-time users
There is little point in creating a set-up wizard specifically for first-time users if those users do not notice it or do not know how to use it. Therefore it’s important for a link to this wizard to appear on Emacs’s opening splash screen. Clicking this link will take the user directly to the first page of the wizard, which will explain in more detail how to continue.
Goal 2: do not interfere with more experienced users
While the splash screen link is not particularly intrusive and can simply be ignored, it can also be removed simply. Firstly, if the user already has an
init.el file, the link will no longer be shown. Secondly, if the user’s configuration sets the
inhibit-emacs-wizard-link flag then it will also not be shown.
How the wizard could work
With my prototype, the wizard adds a link to itself on the Emacs splash screen if it hasn’t specifically been disabled and if no user
init.el file is found.
Following this link replaces the splash screen with the Emacs Set-up Wizard buffer. This buffer contains short introductory text followed by a series of buttons which the user can choose in order to generate a specific configuration. The three configuration options included in the prototype are: -
- Emacs defaults: this does almost nothing and is the first option. I think it’s very important that people know that the default Emacs configuration is an equally valid choice to any other option, hence it appears first.
- Vim-emulation: this installs
evil-modeand does anything else necessary to make Emacs work like Vim. This is for users coming from Vim who want a similar experience.
- Standards-compliant mode: this enables
cua-modeand modifies things here and there to make Emacs work more like other text editors. This would probably be the most common choice for newcomers.
Following the user’s choice, the window will be split into two. The left-hand window will display a message explaining that their new configuration is shown in the right-hand window. I think it’s very important that users see this configuration rather than it being hidden away. The power of Emacs comes from knowing that the configuration is a program written in Emacs Lisp just like much of the functionality in Emacs itself, and this should not be hidden away. The left-hand window would ideally explain this, as well as where this configuration file should be saved and how it can and should be modified.
The wizard will offer to save the generated
init.el for the user and should also make a backup of any existing file. Finally it will explain that this file can simply be deleted and the wizard can be run again. As this is just a prototype, the wizard actually saves the file to
init.el.wizard to avoid overwriting a real configuration file.
init.el file has been saved to the correct location, the splash screen link to the wizard will no longer appear. However a link will still be available in the Help menu should the user wish to run it again.
While I think the description above takes care of the major configuration, there is also the option of adding another stage to the wizard where some external packages are recommended. One which immediately comes to mind would be
which-key. A list of such packages could be displayed with a check box allowing users to select the packages they wish to install. Each package could also include a short description detailing why they might want to choose it.
I’ve added three main configuration options for demonstration purposes. There’s no reason why these couldn’t be changed of course, they were just the first three that came to mind. I also haven’t put much thought into the wording, so this could certainly be improved.
The prototype assumes the user is running a POSIX-compliant OS such as Linux and therefore gives instructions specific to that platform. The actual wizard should detect which platform the user is using and act accordingly. This includes saving the generated
init.el to the correct location and displaying help text relevant to the platform.
I think the inclusion of a simple wizard such as this would be a win-win situation for Emacs. It provides a nice friendly avenue for new users to follow while keeping out of the way of those people who already use Emacs.
A famous proverb states that “a journey of a thousand miles starts with a single step”, so why not make this first step as easy as possible? This can only serve to make newcomers feel more welcome and gently start them on the path to Emacs enlightenment!