March 16, 2025
So there's no sales pitch here, except to say that I've tried to pre-configure Emacs as much as possible, to make it usable. Then we can ratchet up the knowledge, one tiny droplet at a time, until you've got what you need.
Wanna give it a try? What's to lose, really?
Choose your platform and install Emacs:
sudo apt install emacs
or brew install emacs
choco install emacs
pkg install emacs
Once installed, open Emacs and clear the creepy startup screen by pressing `q`.
.emacs
fileI've set this Emacs configuration file here in plain text for a very good reason: It only depends on this site; if you can see this page, you can get to the config file.
;; ------------- copy from here --------------------- ;; behave like every other system in the world (cua-mode) ;; open file (C-x C-f still works) (global-set-key (kbd "C-o") 'find-file) ;; find text (overrides original 'forward') (global-set-key (kbd "C-f") 'search-forward) ;; save file (C-x C-s still works) (global-set-key (kbd "C-s") 'save-buffer) ;; save as (overrides original 'home') (global-set-key (kbd "C-a") 'write-file) ;; exit emacs (overides original 'end') (global-set-key (kbd "C-e") 'save-buffers-kill-terminal) ;; open init file (overrides original 'tab') (global-set-key (kbd "C-i") 'my/edit-init) ;; close file (overrides original 'kill-line') (global-set-key (kbd "C-k") 'kill-buffer) ;; ------------- copy to here ---------------------
Download the .emacs
file and save it to your home directory (~/.emacs
on Linux/macOS, %APPDATA%\.emacs
on Windows). Restart Emacs, and you're ready to roll.
ctrl
key and press o
(lower-case letter "O").foo
is a classic one.
Enter
.Congrats. You just created and opened a file.
Tip: Emacs doesn't distinguish between new files and existing ones. If the filename you type exists in the directory you're in now, it will bring that one up. If not, it will create it. This is one of the ways Emacs actually simplifies working with text.
Doesn't matter much what you type, but if you're stumped, here's a famouse opening sentence suggested by a wealthy Hollywood agent that you can use to start a novel:
Mary walked down the street and never came back.
To save your possibly-future-prize-winning prose, we're going to leverage Emacs favorite key -- the Control (ctrl
) key. From now on, we'll abbreviate these "Control codes" as C-[some-other-key]
.
Press C-s
(hold ctrl
down and press s
) to save the file.
There you go. Your novel is started.
Novels being the chimeric beasts that they are, you'll probably change this a dozen times, then finally decide that you liked the first version -- but you've overwritten it several different times! Not to worry. Every time the Muse strikes, you can open the old file and save it as a new version.
C-a
.[name]-v[n]
, where you increment the [n]
every time, so for example, "foo-v2").
Enter
.You just saved it under a new name, and if look at the mode line (the reverse video line one line above the bottom of the window), you'll see that you're now editing the new file. Mission accomplished.
Note that later on, if you keep going with this little tutorial, you'll learn a wonderful Emacs add-on called "magit" that lets you keep every version you ever typed all in one place, and pick out old ones -- easily -- when you need them. But that is many bridges down the river yet....