*emacsgolf*
Every keystroke counts. Literally.
Given a start buffer and a target buffer, hole out in as few keystrokes as possible. Real Emacs, real keybindings, and a community of Emacsgolfers whose solutions will teach you tricks you didn't know Emacs had — one keystroke at a time.
The holes
Transposition Trouble
Two pairs of words have swapped places overnight. Swap them back so the sentence reads as it should.
Take a Number
Number each line: 1., 2., 3., and so on. Rectangle commands were invented for exactly this.
The Great Reversal
Reverse the order of the lines: last line first, first line last.
Snake Charmer
This Python code is joining a JavaScript codebase. Rename every snake_case identifier to camelCase before code review.
Order! Order!
These #include lines are in the wrong order. Sort them alphabetically before the linter notices.
No Comment
Delete every comment line. The code itself stays exactly where it is.
The Ace
Re-wrap this one long line into a paragraph at most 70 columns wide. One perfect swing is enough.
Cut to Credits
The credits belong at the end of the film, not the start. Move the first line to the bottom.
The Shouting
HR has asked for the printer memo again — this time in lowercase. Careful: stock Emacs ships some of its sharpest tools disabled.
Needle in a Haystack
One word in this text is misspelled. Search for it instead of scrolling — then swap the two letters that are out of order.
Twin Cities
This list of cities has duplicates. Keep the first appearance of each city and delete the repeats.
Columns of Power
Delete the TEMP column from every line and close the gap. Rectangle commands were invented for this too.
The Great Rename
Code review says tmp is not a name. Rename every occurrence to results — query-replace was born for this.
Stoppage Time
Convert each minutes:seconds stamp to plain seconds — 05:16 is 316. A classic from the Vim-vs-Emacs wars (Vim’s best: 53 keystrokes); query-replace-regexp can do arithmetic.
Military Time
The timestamps are 12-hour with a/p markers. Rewrite each as 24-hour hh:mm — 7:14a is 07:14, 3:47p is 15:47 — leaving the data alone. Afternoon costs +12.
Two for One
Every symbol pair is registered twice, once per direction. Collapse each mirrored pair of puthash calls into one xmsi-add-cycle. The original challenge was set in 29 keystrokes — beat it.
Separation Agreement
Split each defvar into a bare declaration and a separate setq holding the value. Structural sexp commands shine here.
How to play
-
1 Get the client
curl -O https://emacsgolf.com/emacsgolf.el
then, in Emacs:
(load "~/path/to/emacsgolf.el")— or drop it on yourload-pathand(require 'emacsgolf). -
2 Claim your name
M-x emacsgolf-registerPick a golfer name once; the server hands back a token that identifies your submissions from then on. Guard it like a favorite putter.
-
3 Pick a hole
M-x emacsgolfBrowse the course, hit RET on a hole. You get the start buffer on the left, the target on the right, and a running keystroke meter in the mode line.
-
4 Hole out
C-c C-c
when your buffer matches the target. Every keystroke from tee-off to C-c C-c counts — including M-x, minibuffer typing, and that C-g you'll regret. Submit, and enter the leaderboard.
Scores are verified by replaying your keystrokes in vanilla
emacs -Q on the server — that's stock Emacs, so custom keybindings
won't survive the replay (and neither, for now, do keyboard-macro definitions).
Entries marked † were accepted without replay.
In-game keys: C-c C-c check & submit · C-c C-d diff against target ·
C-c C-r start over · C-c C-k quit the round.